blob: f9286ad41b95817dee997313e9d4cde9476465aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
module Main(main) where
import Foreign
import Foreign.C
type HsCallback = CInt -> IO ()
foreign import ccall "T15933.h function_in_c"
functionInC :: FunPtr HsCallback -> IO ()
foreign import ccall "wrapper"
wrap :: HsCallback -> IO (FunPtr HsCallback)
main = do
f <- wrap $ \x -> print x
functionInC f
freeHaskellFunPtr f
|