tracing segfaults with FFI
Gaal Yahas
gaal at forum2.org
Wed Jan 4 01:34:14 EST 2006
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 <gaal at forum2.org>
http://gaal.livejournal.com/
More information about the Glasgow-haskell-users
mailing list