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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe