On 8 April 2015 at 16:34, Nicolas Ojeda Bar <[email protected]> wrote:
> I have a value of type `unit ptr` that points to a function with known
> signature.  Is there a way to obtain an OCaml function out of it in order to
> call it ?
>
> In other words, I am looking for a function with signature : `unit ptr -> 'a
> fn -> 'a`.

I think this is what you're looking for:

   # fun c f -> coerce (ptr void) (Foreign.funptr f) c;;
   - : unit Ctypes_static.ptr -> ('a -> 'b) fn -> 'a -> 'b = <fun>
_______________________________________________
Ctypes mailing list
[email protected]
http://lists.ocaml.org/listinfo/ctypes

Reply via email to