Update base for latest Safe Haskell.
[packages/base.git] / Foreign / ForeignPtr.hs
1 {-# LANGUAGE Unsafe #-}
2 {-# LANGUAGE CPP, NoImplicitPrelude #-}
3 {-# OPTIONS_HADDOCK hide #-}
4
5 -----------------------------------------------------------------------------
6 -- |
7 -- Module : Foreign.ForeignPtr
8 -- Copyright : (c) The University of Glasgow 2001
9 -- License : BSD-style (see the file libraries/base/LICENSE)
10 --
11 -- Maintainer : ffi@haskell.org
12 -- Stability : provisional
13 -- Portability : portable
14 --
15 -- The 'ForeignPtr' type and operations. This module is part of the
16 -- Foreign Function Interface (FFI) and will usually be imported via
17 -- the "Foreign" module.
18 --
19 -----------------------------------------------------------------------------
20
21 module Foreign.ForeignPtr (
22 -- * Finalised data pointers
23 ForeignPtr
24 , FinalizerPtr
25 #if defined(__HUGS__) || defined(__GLASGOW_HASKELL__)
26 , FinalizerEnvPtr
27 #endif
28 -- ** Basic operations
29 , newForeignPtr
30 , newForeignPtr_
31 , addForeignPtrFinalizer
32 #if defined(__HUGS__) || defined(__GLASGOW_HASKELL__)
33 , newForeignPtrEnv
34 , addForeignPtrFinalizerEnv
35 #endif
36 , withForeignPtr
37
38 #ifdef __GLASGOW_HASKELL__
39 , finalizeForeignPtr
40 #endif
41
42 -- ** Low-level operations
43 , touchForeignPtr
44 , castForeignPtr
45
46 -- ** Allocating managed memory
47 , mallocForeignPtr
48 , mallocForeignPtrBytes
49 , mallocForeignPtrArray
50 , mallocForeignPtrArray0
51 -- ** Unsafe low-level operations
52 , unsafeForeignPtrToPtr
53 ) where
54
55 import Foreign.ForeignPtr.Safe
56
57 import Foreign.Ptr ( Ptr )
58 import qualified Foreign.ForeignPtr.Unsafe as U
59
60 {-# DEPRECATED unsafeForeignPtrToPtr "Use Foreign.ForeignPtr.Unsafe.unsafeForeignPtrToPtr instead; This function will be removed in the next release" #-}
61 {-# INLINE unsafeForeignPtrToPtr #-}
62 unsafeForeignPtrToPtr :: ForeignPtr a -> Ptr a
63 unsafeForeignPtrToPtr = U.unsafeForeignPtrToPtr
64