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