addForeignPtrFinalizer
Ross Paterson
ross at soi.city.ac.uk
Thu Sep 26 19:24:57 EDT 2002
On Thu, Sep 26, 2002 at 04:40:42PM +0100, Alastair Reid wrote:
>
> > Still hoping ;-) The discussion seemed to stop without reaching a
> > conclusion last time.
>
> I thought it was concluded and the report changed such that all three
> compilers which implement the ffi spec can implement it without
> receiving a heart, lung and liver transplant.
I'm a bit puzzled. Hugs has
primitive newForeignPtr ::
Ptr a -> FunPtr (Ptr a -> IO ()) -> IO (ForeignPtr a)
So what's wrong with
newForeignPtr' :: Ptr a -> IO () -> IO (ForeignPtr a)
newForeignPtr' p hf = do
cf <- wrapFinalizer (const hf)
newForeignPtr p cf
foreign import ccall "wrapper" wrapFinalizer ::
(Ptr a -> IO ()) -> IO (FunPtr (Ptr a -> IO ()))
More information about the FFI
mailing list