1 {-# LANGUAGE ForeignFunctionInterface #-}
5 import Foreign
.C
(CInt
(..))
7 foreign import ccall
"clib.h meaning_of_life_c"
8 meaning_of_life_c
:: IO CInt
12 secret
<- meaning_of_life_c
13 -- The value 11 comes from __TESTOPT_C__ - see the cabal file.
15 then putStrLn ("The secret is " ++ show secret
)
16 else error ("Expected value 11, got " ++ show secret
)