Hi,
I try to initialize a C struct using the FFI API and ghc stays blocked when I execute my code (and I got sometimes the error "out of memory").
I do not understand, I do not find any mistake in my code:
{-# OPTIONS -XTypeSynonymInstances #-}
import Foreign.C.Types
import Foreign.Marshal.Alloc
import Foreign.Ptr
import Foreign.Storable
type CStruct = (CULong, CULong)
instance Storable CStruct where
sizeOf _ = 2*sizeOf (undefined::CULong)
alignment _ = alignment (undefined::CULong)
test = alloca (\pStruct -> do
poke pStruct ( (fromIntegral 1)::CULong, (fromIntegral 1)::CULong )
)
Thanks for your help.
Marco