[EMAIL PROTECTED] (Marcin 'Qrczak' Kowalczyk) wrote,

> Wed, 16 Aug 2000 07:32:48 -0700, Simon Marlow <[EMAIL PROTECTED]> pisze:
> 
> > I'm not sure I understand; how does autoPtrToBytes work if it
> > doesn't use a ForeignObj?
> 
> autoPtrToBytes:: Int -> IO (Ptr a)
> autoPtrToBytes size = do
>     ptr <- mallocBytes size
>     addFinalizer ptr (free ptr)
>     return ptr

This looks very nice.  My only concern is that
`addFinalizer' is a weak pointer operation, and thus, not
part of the core FFI (which only provides ForeignObj and
StablePtr).

Simon, could you give us an idea how easy or difficult it
would be to implement addFinalizer without having all of
weak pointers?[1]

Cheers,
Manuel

[1] I don't have anything against weak pointers.  This is
    again only my "minimise the extension creep" paranoia in
    the hope to have a portable FFI.  

    Malcolm, do you have any comments on addFinalizer as
    part of the core FFI?

Reply via email to