Skip to content
Snippets Groups Projects
Commit 226b5062 authored by sof's avatar sof
Browse files

[project @ 1999-04-12 18:32:17 by sof]

Added Haskell wrapper for freeHaskellFunctionPtr()
parent 358b8cde
No related merge requests found
......@@ -52,6 +52,8 @@ module IOExts
#endif
, unsafePtrEq
, freeHaskellFunctionPtr
) where
......@@ -73,6 +75,7 @@ import PrelGHC
import PrelHandle
import PrelErr
import IO ( hPutStr, hPutChar )
import PrelAddr ( Addr )
#endif
import Ix
......@@ -184,3 +187,18 @@ performGC = _ccall_GC_ performGC
#endif
\end{code}
When using 'foreign export dynamic' to dress up a Haskell
IO action to look like a C function pointer, a little bit
of memory is allocated (along with a stable pointer to
the Haskell IO action). When done with the C function
pointer, you'll need to call @freeHaskellFunctionPtr()@ to
let go of these resources - here's the Haskell wrapper for
that RTS entry point, should you want to free it from
within Haskell.
\begin{code}
foreign import ccall "freeHaskellFunctionPtr"
freeHaskellFunctionPtr :: Addr -> IO ()
\end{code}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment