m v mivori at
Mon Feb 3 06:03:57 EST 2003

I do not understand the rational behind the type of, why the change from the 
previous definition:

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

suppose I have a function

  foreign import ccall fooalloc :: IO (Ptr Foo)


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

now how do I create a foreign pointer without either using:

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

or declaring

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

after all why should I need to import and then re-export or suppose I want 
foofree as a function or for
that matter suppose Foo were a simple memory alloc which could be freed from 
haskell, why should we be forced to wrap a haskell function to create a 
foreign pointer, or am I missing something ?

MSN 8 with e-mail virus protection service: 2 months FREE*

More information about the FFI mailing list