
12 Jul
2010
12 Jul
'10
3:54 p.m.
Excerpts from Evan Laforge's message of Mon Jul 12 14:56:11 -0400 2010:
But I'm not convinced that's actually enough because the C code is still running outside of a withForeignPtr. I would have to do something really hairy like call back to C from the haskell callback, wrapping it in withForeignPtr. Is there a better way to convince the GC that the pointer should remain alive until I explicitly release it from C? The ideal I think would be a ref count that would keep the pointer alive while >0, that could be decremented from C.
The function you are looking for is withForeignPtr. touchForeignPtr also works. Cheers, Edward