[Haskell-cafe] FFI and modifying haskell memory
Joel Reymont
joelr1 at gmail.com
Fri Oct 21 09:39:37 EDT 2005
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/
More information about the Haskell-Cafe
mailing list