
13 Jul
2010
13 Jul
'10
4:17 p.m.
Excerpts from Axel Simon's message of Tue Jul 13 16:03:01 -0400 2010:
If your C code has a way to properly unref a pointer then you could wrap your ForeignPtr in a StablePtr and pass that to C land. Once C has freed the StablePtr the ForeignPtr can become dead when Haskell has dropped all references and it will be garbage collected.
Does ForeignPtr have a guaranteed representation from C land? I feel like you want to create a stable pointer and then unsafely cast the foreign pointer into a real pointer, which would effectively fizzle the original foreign pointer's finalizer. Cheers, Edward