Dimitry Golubovsky wrote:
Hi,

If I have a C function returning a structure (not a pointer, but structure itself), can this be accomodated via FFI?

No. The way data is organised in memory is dramatically different in Haskell when compared with C. You need to write functions to read in each field in turn and then "reconstruct" the structure on the Haskell side.


It's a tedious process. My advice is that if you have a lot of structures to read, write a (simple) preprocessor to generate the marshalling code.. that's what I did.

Ben.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to