[Ur] callbacks from the c ffi

Greg Samsa greg0r.samsa at yahoo.com
Sat Sep 29 18:08:23 EDT 2012


Hi Adam and Marc,
Thank you for the replies!  I am looking at Ur to help me manage files (image, video and so on).  

I'd like to be able to use FUSE to make file uploads easier for myself (while Ur would handle file metadata from a standard db/web app), and considered having the Ur code tightly integrated with the FUSE API (which is callback based - http://fuse.sourceforge.net/doxygen/structfuse__operations.html).  Hopefully this very high level description makes sense.

I think for now I can accomplished my goals by having the FUSE code be a separate daemon that simply makes http calls from the FUSE layer into the Ur app. This is probably a cleaner and more robust solution, but I can't help thinking (perhaps irrationally) that it would be a killer feature for Ur generated C functions to be embeddable into other applications languages :)

At some point when I get further I hope to post to github.
-Greg

--- On Fri, 9/28/12, Adam Chlipala <adamc at csail.mit.edu> wrote:

> From: Adam Chlipala <adamc at csail.mit.edu>
> Subject: Re: [Ur] callbacks from the c ffi
> To: "The Ur programming language" <ur at impredicative.com>
> Date: Friday, September 28, 2012, 4:43 AM
> On 09/27/2012 09:36 PM, Greg Samsa
> wrote:
> > I've been happily playing with Ur/Web and am pleased
> with the results so far.  One problem I am stuck on
> however is creating a callback from Ur, in other words,
> calling a C function that can then call Ur functions. 
> Unless I am misreading the docs this doesn't seem to be
> currently supported.
> > 
> > In looking at the generated C code, the api's generated
> are very straight forward, would it be possible to simply
> call those from a C function or would this have unintended
> consequences?
> >    
> 
> Glad to hear you're happy so far. :)
> 
> You're right that there is no documented support right now
> for calling Ur functions from C.  One big impediment is
> that function names are "mangled" in a way that is
> intentionally unspecified and nondeterministic, so it will
> not be easy to predictably identify an Ur function from C.
> 
> You would certainly need to understand Ur region-based
> memory management to call Ur functions safely.
> 
> Can you fill us in more on your big-picture context? 
> Why do you want to call Ur functions from C?
> 
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
> 



More information about the Ur mailing list