
16 Jun
2009
16 Jun
'09
9:48 a.m.
It's not usual, but it is allowed to have values of structs passed between functions directly instead of using pointers: /*****/ struct ex { int x; int y; int z; }; ex example_functions (ex p) { (...) } /*****/ Would it be possible to allow that in Haskell FFI by, say, allowing any instance of Storable to be used in a 'foreign' declaration? Like: -- data Ex = (...) instance Storable Ex where sizeOf _ = ... alignment = sizeOf (...) foreign import ccall "example_functions" exampleFunction :: Ex -> IO Ex -- Thanks, Maurício