summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi/should_run/fptrfail01.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/ffi/should_run/fptrfail01.hs')
-rw-r--r--testsuite/tests/ffi/should_run/fptrfail01.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_run/fptrfail01.hs b/testsuite/tests/ffi/should_run/fptrfail01.hs
new file mode 100644
index 0000000000..97b331e96b
--- /dev/null
+++ b/testsuite/tests/ffi/should_run/fptrfail01.hs
@@ -0,0 +1,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")