[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Dmitry Bely <dbely@m...> |
| Subject: | Re: [Caml-list] CamlIDL question |
Xavier Leroy <xavier.leroy@inria.fr> writes: >> Is the below trick is possible in CamlIDL? >> I want to wrap C library that uses structs for storing >> pointers to functions > > No, CamlIDL doesn't support C function pointers. The reason is that > mapping C functions pointers to Caml functions is easy, but mapping > Caml function closures to C functions is nearly impossible (there is > nowhere to store and pass the environment part of the closure). It's possible using the "trampoline" technique, when the necessary small stub functions are generated on the fly in the data (or stack) segment. This is how gcc's nested functions work. There is "ffcall" library that implements trampolines for (probably) all hardware platforms where OCaml may run. Am I using it with OcamlIDL to do just what Youry asked for. Unfortinately ffcall's author website has been disappeared, but it should not be a problem to find "ffcall-1.8c.tar.gz" somethere in the Internet. - Dmitry Bely ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners