blob: 5aea5a88a17df71a7575fb098c48b1804944d0dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
{-# LANGUAGE ForeignFunctionInterface #-}
-- | Test that unsafe FFI calls crash the RTS if they attempt to re-enter
-- Haskell-land
module Main where
import Foreign
foreign import ccall "wrapper" wrap_f :: IO () -> IO (FunPtr (IO ()))
foreign import ccall unsafe hello :: FunPtr (IO ()) -> IO ()
f :: IO ()
f = putStrLn "Back in Haskell"
main :: IO ()
main = do
putStrLn "In Haskell"
wrap_f f >>= hello
putStrLn "Finished"
|