<div dir="ltr">Thanks ! That should do it.<div><br></div><div>Best wishes,</div><div>Nicolas</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 8, 2015 at 4:42 PM, Jeremy Yallop <span dir="ltr"><<a href="mailto:yallop@gmail.com" target="_blank">yallop@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 8 April 2015 at 16:34, Nicolas Ojeda Bar <<a href="mailto:no263@dpmms.cam.ac.uk">no263@dpmms.cam.ac.uk</a>> wrote:<br>
> I have a value of type `unit ptr` that points to a function with known<br>
> signature. Is there a way to obtain an OCaml function out of it in order to<br>
> call it ?<br>
><br>
> In other words, I am looking for a function with signature : `unit ptr -> 'a<br>
> fn -> 'a`.<br>
<br>
</span>I think this is what you're looking for:<br>
<br>
# fun c f -> coerce (ptr void) (Foreign.funptr f) c;;<br>
- : unit Ctypes_static.ptr -> ('a -> 'b) fn -> 'a -> 'b = <fun><br>
</blockquote></div><br></div>