newForeignPtr

m v mivori at hotmail.com
Mon Feb 3 05:20:03 EST 2003


I do not understand the rational of the type of:

	newForeignPtr :: Ptr a -> FunPtr (Ptr a -> IO ()) -> IO (ForeignPtr a)

suppose I have a c function

	foreign import ccall fooalloc :: Ptr Foo

and another

	foreign import ccall foofree :: Ptr Foo -> IO ()

now I want to combine fooalloc and foofree to create a Foreign pointer 
without wrapping foofree again, as in:

	 foreign import "wrapper" mkfoofree :: FunPtr (Ptr Foo -> IO ())

which I think counter productive - why should I import a function only to 
have to re-export it again !
previouse proposals did not require this - or am I missing something ?

why should the finaliser be a foreign function ?



_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail




More information about the FFI mailing list