[Haskell-cafe] Haskell FFI and finalizers
Stefan O'Rear
stefanor at cox.net
Wed Oct 3 20:07:34 EDT 2007
On Thu, Oct 04, 2007 at 12:55:41AM +0200, Maxime Henrion wrote:
> When writing the binding for foo_new(), I need to open a file with
> fopen() to pass it the FILE *. Then I get a struct foo * that I can
> easily associate the the foo_destroy() finalizer. However, when
> finalizing the struct foo * object, I want to also close the FILE *
> handle.
>
> If I write a small C function for doing the finalizer myself, I still
> wouldn't get passed the FILE * to close, only the struct foo * pointer
> which is of no use.
Ah, yes, this does make the situation more interesting.
Looks like newForeignPtrEnv is maybe what you want?
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071003/c44b6b44/attachment.bin
More information about the Haskell-Cafe
mailing list