[ocaml-ctypes] Inverted stubs

Thomas Braibant thomas.braibant at gmail.com
Tue Sep 30 11:09:30 BST 2014


Hi list,

First, I would like to report that my first attempt to make bindings
using Ctypes for a sizable library was a success, and I would like to
congratulate the people behind Ctypes for making such a wonderful
library.

Now, I would like to generate inverted stubs that match a third party
C header file (the same one that I used to make my bindings in the
first place). Generally speaking, this should be possible I suppose.
However, one of the functions from this interface returns a struct
that contains function pointers to all the other functions exposed in
the interface. I am reasonably convinced that it is out of the scope
of what Ctypes can do, but I wanted to be sure about that.

Then, I think my best chance is to write a shim in C that does just
the last step of implementing "the function that returns a struct that
contains function pointers to all the other functions". If anyone has
an opinion on this, I would quite happy to hear about it.

Best,
Thomas


More information about the Ctypes mailing list