FFI and modifying haskell memory

21 Oct
2005
21 Oct
'05
1:39 p.m.
Folks, I stumbled upon this when binding the Zlib library and want to make sure I'm doing this right. foreign import ccall unsafe "uncompress" uncompress_ :: Ptr Word8 -> Ptr CULong -> Ptr Word8 -> CULong -> IO CInt You give this function the address of your size as second argument and it updates size for you. basic uncompress(char* buf, unsigned long *size, ...) for you. Is it correct that I need to allocate a chunk of 4 bytes to be passed into C and updated there and then need to peek my value from that chunk of memory? I thought StablePtr would give me the address of a Haskell value but it gives me an offset into some table instead. Thanks, Joel -- http://wagerlabs.com/
7200
Age (days ago)
7200
Last active (days ago)
0 comments
1 participants
participants (1)
-
Joel Reymont