
21 Oct
2005
21 Oct
'05
2:19 p.m.
Is there a particular reason why StablePtr cannot provide a "fixed" memory address? Then 4 bytes of memory won't need to be allocated so that C could write to them and C could just modify the Haskell variable. On Oct 21, 2005, at 3:17 PM, Simon Marlow wrote:
yes, something like
with $ \pculong -> r <- uncompress_ buf pculong ... size <- peek pculong
I thought StablePtr would give me the address of a Haskell value but it gives me an offset into some table instead.
That's right, the reason being that Haskell values move around when GC happens.