Documentation
createForeignPtr :: FunPtr (Ptr a -> IO ()) -> IO (Ptr a) -> IO (ForeignPtr a)Source
A wrapper for newForeignPtr that handles nullPtrs, and can be chained to an IO Ptr creator.
Example usage:
myPtrCreator = (createForeignPtr deallocFunc) . allocFunc
where, allocFunc :: a->b->c->...-> IO (Ptr z)