[project @ 2001-08-22 11:45:06 by sewardj]
[ghc-hetmet.git] / ghc / tests / ccall / should_compile / cc004.hs
1 -- !!! cc004 -- foreign declarations
2 module ShouldCompile where
3
4 import Foreign
5 import GlaExts
6 import Int
7 import Word
8
9 -- importing functions
10
11 foreign import stdcall "m" m_stdcall :: StablePtr a -> IO (StablePtr b)
12 foreign import ccall   "m" unsafe m_ccall   :: ByteArray Int -> IO Int
13
14 foreign import stdcall "sin" my_sin :: Double -> IO Double
15 foreign import stdcall "cos" my_cos :: Double -> IO Double
16
17 foreign import stdcall "m1" m8  :: IO Int8
18 foreign import stdcall "m2" m16 :: IO Int16
19 foreign import stdcall "m3" m32 :: IO Int32
20 foreign import stdcall "m4" m64 :: IO Int64
21
22 foreign import stdcall dynamic d8  :: Addr -> IO Int8
23 foreign import stdcall dynamic d16 :: Addr -> IO Int16
24 foreign import stdcall dynamic d32 :: Addr -> IO Int32
25 foreign import stdcall dynamic d64 :: Addr -> IO Int64
26
27 foreign import ccall "kitchen" unsafe 
28    sink :: ForeignObj 
29         -> ByteArray Int 
30         -> MutableByteArray Int RealWorld
31         -> Int
32         -> Int8
33         -> Int16
34         -> Int32
35         -> Int64
36         -> Word8
37         -> Word16
38         -> Word32
39         -> Word64
40         -> Float
41         -> Double
42         -> IO ()
43
44
45 foreign import ccall dynamic unsafe
46   sink2 :: Addr
47         -> (ForeignObj 
48         -> ByteArray Int 
49         -> MutableByteArray Int RealWorld
50         -> Int
51         -> Int8
52         -> Int16
53         -> Int32
54         -> Word8
55         -> Word16
56         -> Word32
57         -> Float
58         -> Double
59         -> IO ())
60