More Finaliser Trouble

Wolfgang Thaller wolfgang.thaller at gmx.net
Sun Jul 13 18:33:38 EDT 2003


Daan Leijen <daanleijen at xs4all.nl> wrote:

> (allthough it doesn't answer the question of  [...] how to add parameters to the new newForeignPtr function,)

Should there perhaps be something like ...

newForeignPtrWithUserData :: Ptr a -> Ptr b -> FunPtr (Ptr a -> Ptr b -> IO ()) -> IO (ForeignPtr a)

... where the second argument is a "userData" pointer that gets passed on to the finalizer?
That would correspond to the usual solution used by C programmers.

Cheers,

Wolfgang




More information about the FFI mailing list