Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] create a closure in external C function?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Chris Hecker <checker@d...>
Subject: Re: [Caml-list] create a closure in external C function?

>trampoline+vacall is evil. It uses a global variable; this is not
>thread safe.

Yeah, I was going to look at that closer to see if there's any way to make it thread safe.  It seems a shame to have all of that cross platform work done and then shove the thing in a global...

> Especially if you statically know types of arguments,
>which is the case I am talking about.

Which case are you talking about?  Are you working on this as well?  Are you just talking about wanting to expose qsort and other functions that take callbacks?

> I would like to have this functionality in OCaml's foreign function
>interface, without forcing to rely on an inconvenient third-party
>package.

That would be great, but I'm not sure if anybody's working on this at INRIA.  Heck, we might as well do a proof of concept first before they waste their time on it anyway, and then if it's useful we'll see about making it more official.  If it was built into the compiler it could be made super-clean, basically like external is now...I can see it now...extern[al] "C"!  <ducking and running>  

My original plan wasn't to do the whole thing, it was just to get wglGetProcAddress (and the glx version) working for OpenGL for a library Kipton Barros and I are going to be working on, and then I realized that if I got that working it wouldn't be much harder to just generalize it to GetProcAddress/dlsym, which would have the potential to be hugely useful for all caml programmers, not just OpenGL programmers.  So, I'll probably just do that, assuming it turns out to be possible.

Chris


-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr