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
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to