Background: libguestfs Haskell bindings need a lot of love, and the FFI deeply confuses me.
Background: libguestfs Haskell bindings need a lot of love, and the FFI deeply confuses me.
http://book.realworldhaskell.org/read/interfacing-with-c-the...
It walks you through making some basic PCRE bindings, which is a big enough example that they manage to touch on the important issues. It's a pretty good introduction, I would say, especially in the part that covers interfacing C strings with ByteStrings.
Also (to reply to GP) c2hs is no use because we already have a very detailed and specific description of the interface, and a generator that does all the other bindings[1]. We want to know precisely how to translate our description into Haskell, we don't want to go through another layer.
[1] http://git.annexia.org/?p=libguestfs.git;a=tree;f=generator;...