blob: 97b331e96b1aca6b53ae3c695ad4cced4ff38b91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
{-# LANGUAGE ForeignFunctionInterface #-}
module Main where
import Foreign
import GHC.ForeignPtr
{-# INCLUDE "fptrfail01.h" #-}
foreign import ccall "&f" fptr :: FunPtr (Ptr Int -> IO ())
main :: IO ()
main = do
with (33 :: Int) test
where
test p = do
f <- newForeignPtr_ p
addForeignPtrFinalizer fptr f
addForeignPtrConcFinalizer f (putStrLn "Haskell finalizer")
|