Add explicit `{-# LANGUAGE CPP, PackageImports #-}` pragmas
[packages/haskell2010.git] / Foreign / Ptr.hs
1 {-# LANGUAGE CPP, PackageImports #-}
2 #if __GLASGOW_HASKELL__ >= 701
3 {-# LANGUAGE Safe #-}
4 #endif
5
6 -- | The module "Foreign.Ptr" provides typed pointers to foreign
7 -- entities. We distinguish two kinds of pointers: pointers to data
8 -- and pointers to functions. It is understood that these two kinds
9 -- of pointers may be represented differently as they may be
10 -- references to data and text segments, respectively.
11
12 module Foreign.Ptr (
13
14 -- * Data pointers
15
16 Ptr, -- data Ptr a
17 nullPtr, -- :: Ptr a
18 castPtr, -- :: Ptr a -> Ptr b
19 plusPtr, -- :: Ptr a -> Int -> Ptr b
20 alignPtr, -- :: Ptr a -> Int -> Ptr a
21 minusPtr, -- :: Ptr a -> Ptr b -> Int
22
23 -- * Function pointers
24
25 FunPtr, -- data FunPtr a
26 nullFunPtr, -- :: FunPtr a
27 castFunPtr, -- :: FunPtr a -> FunPtr b
28 castFunPtrToPtr, -- :: FunPtr a -> Ptr b
29 castPtrToFunPtr, -- :: Ptr a -> FunPtr b
30
31 freeHaskellFunPtr, -- :: FunPtr a -> IO ()
32 -- Free the function pointer created by foreign export dynamic.
33
34 -- * Integral types with lossless conversion to and from pointers
35 IntPtr,
36 ptrToIntPtr,
37 intPtrToPtr,
38 WordPtr,
39 ptrToWordPtr,
40 wordPtrToPtr
41
42 ) where
43 import "base" Foreign.Ptr