How to access hs_free_fun_ptr from a Visual Studio DLL

Wolfgang Thaller wolfgang.thaller at gmx.net
Mon Mar 27 13:56:14 EST 2006


>    C -> adjustor -> stub -> Haskell -> stub -> adjustor -> C
>
> It could be the case that the adjustor tail-jumps to the stub, but  
> this is not
> guaranteed to be the case for all platforms.

Hmmm, I thought it was.
Well, the FFI addendum is rather vague on this point; this seems to  
be all it says about freeHaskellFunPtr.

freeHaskellFunPtr :: FunPtr a -> IO ()
   Release the storage associated
   with the given \code{FunPtr}, which must have been obtained from a  
wrapper
   stub.  This should be called whenever the return value from a  
foreign import
   wrapper function is no longer required; otherwise, the storage it  
uses will
   leak.

Do I need the FunPtr value in order to return to C land? I didn't  
think so. The addendum doesn't say so. (It doesn't clearly say  
otherwise, though).

All of the implementations in Adjustor.c *except* for the IA-64 one  
go to some lengths to ensure that a tail-calll is used:

C -> adjustor -> stub  -> Haskell -> stub -> (maybe some static code)  
-> C

I think this confusion should be fixed...

Cheers,

Wolfgang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/glasgow-haskell-users/attachments/20060327/caa59158/attachment.htm


More information about the Glasgow-haskell-users mailing list