[ocaml-ctypes] Passing Caml function to C

Serge Sivkov ssp.mryau at gmail.com
Thu Dec 28 13:59:46 GMT 2017


An one of simplest methods will be to use
Callback.register name callback_func
on OCaml side and to use something like:
closure_f = caml_named_value(name);
ml_reply = caml_callback(*closure_f, ml_arg);
on C side.

WBR, ssp

2017-12-28 18:05 GMT+05:00 john skaller <skaller at internode.on.net>:

> There’s some machinery for this but .. well I am suspicious :)
>
> How can this possibly work?
>
> Caml functions are closures,  the only way you could pass
> a closure would be to generate a thunk. I’m suspicious that
> this doesn’t work in general. And you would need to find
> a place to put the thunk which the OS allows you to execute.
>
>> john skaller
> skaller at users.sourceforge.net
> http://felix-lang.org
>
> _______________________________________________
> Ctypes mailing list
> Ctypes at lists.ocaml.org
> http://lists.ocaml.org/listinfo/ctypes
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/ctypes/attachments/20171228/2c477f69/attachment.html>


More information about the Ctypes mailing list