
4 Jan
2006
4 Jan
'06
1:34 a.m.
Hello,
I have these two functions:
freezeNode node = do
ptr <- newStablePtr node
new (castPtr $ castStablePtrToPtr ptr)
thawNode nodePtr = do
deRefStablePtr (castPtrToStablePtr nodePtr)
I use the first to pack a Haskell structure and hand it over to a c
library with FFI. It calls me back (traces show I do get the original
address) but deRefStablePtr causes a segfault.
What am I doing wrong? More generally, how do I approach this kind of
problem? What tools exist that can help me debug FFI code?
--
Gaal Yahas