Hi,<br><br>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").<br>I do not understand, I do not find any mistake in my code:<br>
<br>{-# OPTIONS -XTypeSynonymInstances #-}<br><br>import Foreign.C.Types<br>import Foreign.Marshal.Alloc<br>import Foreign.Ptr<br>import Foreign.Storable<br><br><br>type CStruct = (CULong, CULong)<br><br>instance Storable CStruct where<br>
sizeOf _ = 2*sizeOf (undefined::CULong)<br> alignment _ = alignment (undefined::CULong)<br> <br>test = alloca (\pStruct -> do<br> poke pStruct ( (fromIntegral 1)::CULong, (fromIntegral 1)::CULong )<br> )<br>
<br>Thanks for your help.<br><br>Marco<br>