
8 Aug
2014
8 Aug
'14
3:29 p.m.
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. Donn