[Haskell-cafe] Get out structured data from a C/C++ library inHaskell
donn at avvanta.com
Fri Aug 8 15:29:21 UTC 2014
> How can I do that? In general, I've only seen example of how to exchange
> primitive types with C functions through the FFI, but not for example
> structures or pointers to structures.
Foreign.Storable is the key to packing and unpacking a struct. The
hsc2hs utility adds some support for struct member names, which will
make your code more convenient and robust. You will also find "peek"
and "poke" functions in Foreign.Storable, for pointer access.
More information about the Haskell-Cafe