[ocaml-ctypes] Foreign function interface support

Anil Madhavapeddy anil at recoil.org
Tue Mar 4 09:47:10 GMT 2014


On 4 Mar 2014, at 01:54, Pavel Zaichenkov <zaichenkov at gmail.com> wrote:

> Hi Anil,
> 
> It fails for both OS X and Ubuntu.

Should investigate this separately then -- can you manually write a
trivial C binding that successfully links on MacOS X?
> 
> Regarding Ubuntu. How would you pass "-Wl,--no-as-needed" to
> corebuild? hello (ncurses) example doesn't work on Ubuntu, so this
> could be the case. I want to try it also for minisat library, which is
> available from the repository.
> 
> Although I don't know what is wrong with it in OS X.
> 
> Btw, I get "Unbound value returning_checking_errno" error for datetime
> example in both systems.

I don't have access to an Ubuntu machine to verify this at the moment,
but I suspect that there's some minor interface breakage in RWO due
to the recent Ctypes updates.  I'll rebuild the RWO examples repository
later and update the online examples (print errata will take a little longer)

Off the top of my head, you need something like

-cclib,-Xlinker,-cclib,--no-as-needed,-Wl

to corebuild

(see https://github.com/rgrinberg/onanomsg/blob/master/_oasis for an OASIS example)

The complication is that this will *not* work on MacOS X, since LLVM doesn't support that linker flag. C stub generation will greatly help reduce this complexity when that lands in Ctypes.

-anil


More information about the Ctypes mailing list