summaryrefslogtreecommitdiff
path: root/testsuite/tests/ffi/should_run/ffi007.hs
blob: 506ec57cd3b84cd86a51fe0f22a87e2258cb9023 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- !!! Test System.Exit.exitWith called from a foreign import "wrapper"

import Foreign
import Foreign.C

import System.Exit

type IOF = IO ()
foreign import ccall "wrapper" wrap_f_io :: IOF -> IO (FunPtr IOF)
foreign import ccall "dynamic" call_io :: FunPtr IOF -> IOF

exit = do putStrLn "exiting..."; exitWith ExitSuccess

main = do f <- wrap_f_io exit; call_io f