[Haskell-cafe] Can my type be allowed as return type in FFI?

Andrea Rossato mailing_list at istitutocolli.org
Wed Dec 10 07:44:19 EST 2008


On Wed, Dec 10, 2008 at 12:30:56PM +0000, Duncan Coutts wrote:
> If do recommend reading the FFI spec. It's quite readable and explains a
> lot of the issues. Getting familiar with the Foreign libraries will help
> too. The most important bits are understanding ForeignPtr and the
> Storable class.

I would also add the chapter 17 of Real World Haskell. you can read it
here:

http://book.realworldhaskell.org/read/interfacing-with-c-the-ffi.html

It will guide you through the writing of the bindings to the PCRE
library. Very useful and nicely conceived.

A good collection of Storable instances that I found very helpful in
understanding the subject can be found in the X11 bindings.

Hope this helps,
Andrea


More information about the Haskell-Cafe mailing list