Copyright | (c) Sigbjorn Finne sof@dcs.gla.ac.uk 1999 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | sof@forkIO.com |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Stubs for marshalling and unmarshalling primitive types, as used by HaskellDirect-generated code.
Synopsis
- class Flags a where
- (.+.) :: a -> a -> a
- type Byte = Word8
- type Octet = Byte
- type Wchar_t = Word16
- type Hyper = Int64
- foreignPtrToPtr :: ForeignPtr a -> Ptr a
- marshallInt :: Int -> IO Int
- unmarshallInt :: Int -> IO Int
- writeInt :: Ptr Int -> Int -> IO ()
- readInt :: Ptr Int -> IO Int
- sizeofInt :: Word32
- marshallInt8 :: Int8 -> IO Int8
- unmarshallInt8 :: Int8 -> IO Int8
- writeInt8 :: Ptr Int8 -> Int8 -> IO ()
- readInt8 :: Ptr Int8 -> IO Int8
- sizeofInt8 :: Word32
- marshallInt16 :: Int16 -> IO Int16
- unmarshallInt16 :: Int16 -> IO Int16
- writeInt16 :: Ptr Int16 -> Int16 -> IO ()
- readInt16 :: Ptr Int16 -> IO Int16
- sizeofInt16 :: Word32
- marshallInt32 :: Int32 -> IO Int32
- unmarshallInt32 :: Int32 -> IO Int32
- writeInt32 :: Ptr Int32 -> Int32 -> IO ()
- readInt32 :: Ptr Int32 -> IO Int32
- sizeofInt32 :: Word32
- marshallInt64 :: Int64 -> IO Int64
- unmarshallInt64 :: Int64 -> IO Int64
- writeInt64 :: Ptr Int64 -> Int64 -> IO ()
- readInt64 :: Ptr Int64 -> IO Int64
- sizeofInt64 :: Word32
- marshallHyper :: Hyper -> IO Int64
- unmarshallHyper :: Int64 -> IO Hyper
- writeHyper :: Ptr Hyper -> Hyper -> IO ()
- readHyper :: Ptr Hyper -> IO Hyper
- sizeofHyper :: Word32
- writeInteger :: Ptr Integer -> Integer -> IO ()
- readInteger :: Ptr Integer -> IO Integer
- marshallInteger :: Integer -> IO (Int32, Int32)
- unmarshallInteger :: (Int32, Int32) -> IO Integer
- marshallUInteger :: Integer -> IO (Int32, Int32)
- unmarshallUInteger :: (Int32, Int32) -> IO Integer
- readUInteger :: Ptr Integer -> IO Integer
- writeUInteger :: Ptr Integer -> Integer -> IO ()
- marshallChar :: Char -> IO Char
- unmarshallChar :: Char -> IO Char
- writeChar :: Ptr Char -> Char -> IO ()
- readChar :: Ptr Char -> IO Char
- sizeofChar :: Word32
- marshallWchar_t :: Wchar_t -> IO Wchar_t
- unmarshallWchar_t :: Wchar_t -> IO Wchar_t
- writeWchar_t :: Ptr Wchar_t -> Wchar_t -> IO ()
- readWchar_t :: Ptr Wchar_t -> IO Wchar_t
- sizeofWchar_t :: Word32
- marshallByte :: Byte -> IO Byte
- unmarshallByte :: Byte -> IO Byte
- writeByte :: Ptr Byte -> Byte -> IO ()
- readByte :: Ptr Byte -> IO Byte
- sizeofByte :: Word32
- marshallWord8 :: Word8 -> IO Word8
- unmarshallWord8 :: Word8 -> IO Word8
- writeWord8 :: Ptr Word8 -> Word8 -> IO ()
- readWord8 :: Ptr Word8 -> IO Word8
- sizeofWord8 :: Word32
- marshallWord16 :: Word16 -> IO Word16
- unmarshallWord16 :: Word16 -> IO Word16
- writeWord16 :: Ptr Word16 -> Word16 -> IO ()
- readWord16 :: Ptr Word16 -> IO Word16
- sizeofWord16 :: Word32
- marshallWord32 :: Word32 -> IO Word32
- unmarshallWord32 :: Word32 -> IO Word32
- writeWord32 :: Ptr Word32 -> Word32 -> IO ()
- readWord32 :: Ptr Word32 -> IO Word32
- sizeofWord32 :: Word32
- marshallWord64 :: Word64 -> IO Word64
- unmarshallWord64 :: Word64 -> IO Word64
- writeWord64 :: Ptr Word64 -> Word64 -> IO ()
- readWord64 :: Ptr Word64 -> IO Word64
- sizeofWord64 :: Word32
- marshallDouble :: Double -> IO Double
- unmarshallDouble :: Double -> IO Double
- writeDouble :: Ptr Double -> Double -> IO ()
- readDouble :: Ptr Double -> IO Double
- sizeofDouble :: Word32
- writeFloat :: Ptr Float -> Float -> IO ()
- readFloat :: Ptr Float -> IO Float
- sizeofFloat :: Word32
- marshallBool :: Bool -> IO Int32
- unmarshallBool :: Int32 -> IO Bool
- writeBool :: Ptr Bool -> Bool -> IO ()
- readBool :: Ptr Bool -> IO Bool
- sizeofBool :: Word32
- addNCastPtr :: Ptr a -> Word32 -> Ptr b
- derefPtr :: Ptr (Ptr a) -> IO (Ptr a)
- indexPtr :: Ptr (Ptr a) -> Int -> IO (Ptr a)
- allocOutPtr :: IO (Ptr a)
- allocBytes :: Int -> IO (Ptr a)
- allocWords :: Int -> IO (Ptr a)
- alloc_malloc :: Word32 -> IO (Ptr a)
- free_malloc :: Ptr a -> IO ()
- free :: Ptr a -> IO ()
- alloc :: Word32 -> IO (Ptr a)
- doThenFree :: (Ptr a -> IO ()) -> (Ptr b -> IO c) -> Ptr d -> IO c
- trivialFree :: a -> IO ()
- fillIn :: Int -> (Ptr a -> IO ()) -> IO (Ptr a)
- marshallPtr :: Ptr a -> IO (Ptr a)
- unmarshallPtr :: Ptr a -> IO (Ptr a)
- writePtr :: Ptr (Ptr a) -> Ptr a -> IO ()
- readPtr :: Ptr a -> IO (Ptr b)
- writefptr :: Ptr b -> ForeignPtr a -> IO ()
- marshallunique :: IO (Ptr a) -> (Ptr a -> a -> IO ()) -> Maybe a -> IO (Ptr a)
- marshallMaybe :: (a -> IO b) -> b -> Maybe a -> IO b
- writeMaybe :: (Ptr a -> a -> IO ()) -> Ptr (Maybe a) -> Maybe a -> IO ()
- readMaybe :: (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)
- writeunique :: IO (Ptr a) -> (Ptr a -> a -> IO ()) -> Ptr (Maybe a) -> Maybe a -> IO ()
- writeunique_fun :: IO (Ptr a) -> (Ptr (Ptr a) -> a -> IO ()) -> Ptr (Maybe a) -> Maybe a -> IO ()
- unmarshallunique :: (Ptr a -> IO a) -> Ptr a -> IO (Maybe a)
- readunique :: (Ptr a -> IO a) -> Ptr b -> IO (Maybe a)
- freeunique :: (Ptr a -> IO ()) -> Ptr (Ptr a) -> IO ()
- marshallunique_ptr :: Maybe (Ptr a) -> IO (Ptr a)
- marshallref :: IO (Ptr a) -> (Ptr a -> a -> IO ()) -> a -> IO (Ptr a)
- writeref :: IO (Ptr a) -> (Ptr a -> a -> IO ()) -> Ptr (Ptr a) -> a -> IO ()
- unmarshallref :: (Ptr a -> IO b) -> Ptr a -> IO b
- readref :: (Ptr a -> IO a) -> Ptr (Ptr a) -> IO a
- freeref :: (Ptr b -> IO ()) -> Ptr a -> IO ()
- writeenum16 :: (b -> IO Int16) -> Ptr Int16 -> b -> IO ()
- readenum16 :: (Int16 -> IO a) -> Ptr Int16 -> IO a
- marshallEnum16 :: Enum a => a -> IO Int16
- unmarshallEnum16 :: Enum a => Int16 -> IO a
- marshallEnum32 :: Enum a => a -> IO Int32
- unmarshallEnum32 :: Enum a => Int32 -> IO a
- writeEnum32 :: Enum a => Ptr b -> a -> IO ()
- readEnum32 :: Enum a => Ptr b -> IO a
- writeEnum16 :: Enum a => Ptr b -> a -> IO ()
- readEnum16 :: Enum a => Ptr b -> IO a
- marshalllist :: Word32 -> (Ptr a -> a -> IO ()) -> [a] -> IO (Ptr b)
- unmarshalllist :: Word32 -> Word32 -> Word32 -> (Ptr any -> IO a) -> Ptr b -> IO [a]
- unmarshallSingle :: (Ptr a -> IO a) -> Ptr a -> IO [a]
- writelist :: Bool -> Word32 -> (Ptr a -> a -> IO ()) -> Ptr [a] -> [a] -> IO ()
- readlist :: Word32 -> Word32 -> (Ptr a -> IO a) -> Ptr [a] -> IO [a]
- freelist :: Word32 -> Word32 -> (Ptr a -> IO ()) -> Ptr [a] -> IO ()
- marshallString :: String -> IO (Ptr String)
- marshallBString :: Int -> String -> IO (Ptr String)
- unmarshallString :: Ptr String -> IO String
- unmarshallBString :: Int -> Ptr String -> IO String
- readString :: Ptr (Ptr String) -> IO String
- readBString :: Int -> Ptr (Ptr String) -> IO String
- writeString :: Bool -> Ptr String -> String -> IO ()
- writeBString :: Bool -> Int -> Ptr a -> String -> IO ()
- freeString :: Ptr String -> IO ()
- marshallSequence :: (Ptr a -> a -> IO ()) -> (Ptr a -> IO ()) -> Word32 -> Maybe Word32 -> [a] -> IO (Ptr a)
- unmarshallSequence :: Eq a => (Ptr (Ptr a) -> IO a) -> (Ptr (Ptr a) -> IO Bool) -> Word32 -> Maybe Word32 -> Ptr (Ptr a) -> IO [a]
- readSequence :: Eq a => (Ptr (Ptr a) -> IO a) -> (Ptr (Ptr a) -> IO Bool) -> Word32 -> Maybe Word32 -> Ptr (Ptr a) -> IO [a]
- writeSequence :: Eq a => Bool -> (Ptr a -> a -> IO ()) -> (Ptr a -> IO ()) -> Word32 -> Maybe Word32 -> Ptr a -> [a] -> IO ()
- freeSequence :: Ptr a -> IO ()
- marshallblist :: Word32 -> Word32 -> (Ptr a -> a -> IO ()) -> [a] -> IO (Ptr [a])
- writeblist :: Word32 -> Word32 -> (Ptr a -> a -> IO ()) -> Ptr [a] -> [a] -> IO ()
- readblist :: Word32 -> Word32 -> (Ptr a -> IO a) -> Ptr a -> IO [a]
- word16ToInt32 :: Word16 -> Int32
- word32ToInt32 :: Word32 -> Int32
- int32ToWord32 :: Int32 -> Word32
- int16ToWord32 :: Int16 -> Word32
- intToChar :: Int -> Char
- charToInt32 :: Char -> Int32
- word32ToChar :: Word32 -> Char
- charToWord32 :: Char -> Word32
- toInt32 :: Integral a => a -> Int32
- toInt16 :: Integral a => a -> Int16
- marshallFO :: ForeignPtr a -> IO (ForeignPtr a)
- unmarshallFO :: ForeignPtr a -> IO (ForeignPtr a)
- writeFO :: Ptr (ForeignPtr a) -> ForeignPtr a -> IO ()
- sizeofForeignPtr :: Word32
- nullFinaliser :: FunPtr (Ptr a -> IO ())
- nullFO :: ForeignPtr a
- readStablePtr :: Ptr (StablePtr a) -> IO (StablePtr a)
- marshallStruct :: String -> a -> IO b
- unmarshallStruct :: String -> a -> IO c
- marshallUnion :: String -> a -> IO b
- unmarshallUnion :: String -> a -> b -> IO c
- marshallPointer :: Ptr a -> IO (Ptr a)
- unmarshallPointer :: Ptr a -> IO (Ptr a)
- writePointer :: Ptr (Ptr a) -> Ptr a -> IO ()
- readPointer :: Ptr (Ptr a) -> IO (Ptr a)
- sizeofPtr :: Word32
- primInvokeIt :: (Ptr b -> Ptr a -> IO c) -> Int -> IO (Ptr a) -> IO c
- primInvokeItFO :: (Ptr b -> Ptr a -> IO c) -> Int -> IO (ForeignPtr a) -> IO c
- stackStringLen :: Int -> String -> (Ptr String -> IO a) -> IO a
- enumToFlag :: Enum a => a -> Int
- enumToInt :: Enum a => a -> Int
- flagToIntTag :: Int -> Int
- unboxInt :: Int -> Int#
- toIntFlag :: Int -> Int -> Int
- pow2Series :: Int -> Int32 -> [Int32]
- orList :: [Int] -> Int
- orFlags :: (Num a, Flags a) => [a] -> a
- data Int8
- data Int16
- data Int32
- data Int64
- data Word8
- data Word16
- data Word32
- data Word64
- data Char
- data Double
- data Float
- data Bool
- data Ptr a
- data StablePtr a
- deRefStablePtr :: StablePtr a -> IO a
Documentation
foreignPtrToPtr :: ForeignPtr a -> Ptr a Source #
sizeofInt8 :: Word32 Source #
sizeofInt16 :: Word32 Source #
sizeofInt32 :: Word32 Source #
sizeofInt64 :: Word32 Source #
sizeofHyper :: Word32 Source #
sizeofChar :: Word32 Source #
sizeofByte :: Word32 Source #
sizeofWord8 :: Word32 Source #
sizeofFloat :: Word32 Source #
sizeofBool :: Word32 Source #
allocOutPtr :: IO (Ptr a) Source #
free_malloc :: Ptr a -> IO () Source #
trivialFree :: a -> IO () Source #
writeunique_fun :: IO (Ptr a) -> (Ptr (Ptr a) -> a -> IO ()) -> Ptr (Maybe a) -> Maybe a -> IO () Source #
marshallSequence :: (Ptr a -> a -> IO ()) -> (Ptr a -> IO ()) -> Word32 -> Maybe Word32 -> [a] -> IO (Ptr a) Source #
unmarshallSequence :: Eq a => (Ptr (Ptr a) -> IO a) -> (Ptr (Ptr a) -> IO Bool) -> Word32 -> Maybe Word32 -> Ptr (Ptr a) -> IO [a] Source #
readSequence :: Eq a => (Ptr (Ptr a) -> IO a) -> (Ptr (Ptr a) -> IO Bool) -> Word32 -> Maybe Word32 -> Ptr (Ptr a) -> IO [a] Source #
writeSequence :: Eq a => Bool -> (Ptr a -> a -> IO ()) -> (Ptr a -> IO ()) -> Word32 -> Maybe Word32 -> Ptr a -> [a] -> IO () Source #
freeSequence :: Ptr a -> IO () Source #
word16ToInt32 :: Word16 -> Int32 Source #
word32ToInt32 :: Word32 -> Int32 Source #
int32ToWord32 :: Int32 -> Word32 Source #
int16ToWord32 :: Int16 -> Word32 Source #
charToInt32 :: Char -> Int32 Source #
word32ToChar :: Word32 -> Char Source #
charToWord32 :: Char -> Word32 Source #
marshallFO :: ForeignPtr a -> IO (ForeignPtr a) Source #
unmarshallFO :: ForeignPtr a -> IO (ForeignPtr a) Source #
writeFO :: Ptr (ForeignPtr a) -> ForeignPtr a -> IO () Source #
nullFO :: ForeignPtr a Source #
marshallStruct :: String -> a -> IO b Source #
unmarshallStruct :: String -> a -> IO c Source #
marshallUnion :: String -> a -> IO b Source #
unmarshallUnion :: String -> a -> b -> IO c Source #
primInvokeItFO :: (Ptr b -> Ptr a -> IO c) -> Int -> IO (ForeignPtr a) -> IO c Source #
enumToFlag :: Enum a => a -> Int Source #
flagToIntTag :: Int -> Int Source #
8-bit signed integer type
Instances
16-bit signed integer type
Instances
32-bit signed integer type
Instances
64-bit signed integer type
Instances
8-bit unsigned integer type
Instances
16-bit unsigned integer type
Instances
32-bit unsigned integer type
Instances
64-bit unsigned integer type
Instances
The character type Char
is an enumeration whose values represent
Unicode (or equivalently ISO/IEC 10646) code points (i.e. characters, see
http://www.unicode.org/ for details). This set extends the ISO 8859-1
(Latin-1) character set (the first 256 characters), which is itself an extension
of the ASCII character set (the first 128 characters). A character literal in
Haskell has type Char
.
To convert a Char
to or from the corresponding Int
value defined
by Unicode, use toEnum
and fromEnum
from the
Enum
class respectively (or equivalently ord
and
chr
).
Instances
Bounded Char | Since: base-2.1 |
Enum Char | Since: base-2.1 |
Eq Char | |
Ord Char | |
Read Char | Since: base-2.1 |
Show Char | Since: base-2.1 |
Storable Char | Since: base-2.1 |
Defined in Foreign.Storable | |
Variant Char Source # | |
Defined in System.Win32.Com.Automation inVariant :: ArgIn Char Source # inVarList :: ArgIn [Char] Source # inVarIUnknown :: ArgIn (IUnknown Char) Source # vtEltType :: Char -> VARENUM Source # resVariant :: ArgRes Char Source # defaultVariant :: Char Source # resVarList :: ArgRes [Char] Source # | |
Foldable (UChar :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => UChar m -> m # foldMap :: Monoid m => (a -> m) -> UChar a -> m # foldMap' :: Monoid m => (a -> m) -> UChar a -> m # foldr :: (a -> b -> b) -> b -> UChar a -> b # foldr' :: (a -> b -> b) -> b -> UChar a -> b # foldl :: (b -> a -> b) -> b -> UChar a -> b # foldl' :: (b -> a -> b) -> b -> UChar a -> b # foldr1 :: (a -> a -> a) -> UChar a -> a # foldl1 :: (a -> a -> a) -> UChar a -> a # elem :: Eq a => a -> UChar a -> Bool # maximum :: Ord a => UChar a -> a # minimum :: Ord a => UChar a -> a # | |
Traversable (UChar :: Type -> Type) | Since: base-4.9.0.0 |
Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.
Instances
Eq Double | Note that due to the presence of
Also note that
|
Floating Double | Since: base-2.1 |
Ord Double | Note that due to the presence of
Also note that, due to the same,
|
Read Double | Since: base-2.1 |
RealFloat Double | Since: base-2.1 |
Defined in GHC.Float floatRadix :: Double -> Integer # floatDigits :: Double -> Int # floatRange :: Double -> (Int, Int) # decodeFloat :: Double -> (Integer, Int) # encodeFloat :: Integer -> Int -> Double # significand :: Double -> Double # scaleFloat :: Int -> Double -> Double # isInfinite :: Double -> Bool # isDenormalized :: Double -> Bool # isNegativeZero :: Double -> Bool # | |
Storable Double | Since: base-2.1 |
Variant Double Source # | |
Defined in System.Win32.Com.Automation inVariant :: ArgIn Double Source # inVarList :: ArgIn [Double] Source # inVarIUnknown :: ArgIn (IUnknown Double) Source # vtEltType :: Double -> VARENUM Source # resVariant :: ArgRes Double Source # defaultVariant :: Double Source # resVarList :: ArgRes [Double] Source # | |
Foldable (UDouble :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => UDouble m -> m # foldMap :: Monoid m => (a -> m) -> UDouble a -> m # foldMap' :: Monoid m => (a -> m) -> UDouble a -> m # foldr :: (a -> b -> b) -> b -> UDouble a -> b # foldr' :: (a -> b -> b) -> b -> UDouble a -> b # foldl :: (b -> a -> b) -> b -> UDouble a -> b # foldl' :: (b -> a -> b) -> b -> UDouble a -> b # foldr1 :: (a -> a -> a) -> UDouble a -> a # foldl1 :: (a -> a -> a) -> UDouble a -> a # elem :: Eq a => a -> UDouble a -> Bool # maximum :: Ord a => UDouble a -> a # minimum :: Ord a => UDouble a -> a # | |
Traversable (UDouble :: Type -> Type) | Since: base-4.9.0.0 |
Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.
Instances
Eq Float | Note that due to the presence of
Also note that
|
Floating Float | Since: base-2.1 |
Ord Float | Note that due to the presence of
Also note that, due to the same,
|
Read Float | Since: base-2.1 |
RealFloat Float | Since: base-2.1 |
Defined in GHC.Float floatRadix :: Float -> Integer # floatDigits :: Float -> Int # floatRange :: Float -> (Int, Int) # decodeFloat :: Float -> (Integer, Int) # encodeFloat :: Integer -> Int -> Float # significand :: Float -> Float # scaleFloat :: Int -> Float -> Float # isInfinite :: Float -> Bool # isDenormalized :: Float -> Bool # isNegativeZero :: Float -> Bool # | |
Storable Float | Since: base-2.1 |
Variant Float Source # | |
Defined in System.Win32.Com.Automation inVariant :: ArgIn Float Source # inVarList :: ArgIn [Float] Source # inVarIUnknown :: ArgIn (IUnknown Float) Source # vtEltType :: Float -> VARENUM Source # resVariant :: ArgRes Float Source # defaultVariant :: Float Source # resVarList :: ArgRes [Float] Source # | |
Foldable (UFloat :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => UFloat m -> m # foldMap :: Monoid m => (a -> m) -> UFloat a -> m # foldMap' :: Monoid m => (a -> m) -> UFloat a -> m # foldr :: (a -> b -> b) -> b -> UFloat a -> b # foldr' :: (a -> b -> b) -> b -> UFloat a -> b # foldl :: (b -> a -> b) -> b -> UFloat a -> b # foldl' :: (b -> a -> b) -> b -> UFloat a -> b # foldr1 :: (a -> a -> a) -> UFloat a -> a # foldl1 :: (a -> a -> a) -> UFloat a -> a # elem :: Eq a => a -> UFloat a -> Bool # maximum :: Ord a => UFloat a -> a # minimum :: Ord a => UFloat a -> a # | |
Traversable (UFloat :: Type -> Type) | Since: base-4.9.0.0 |
Instances
A value of type
represents a pointer to an object, or an
array of objects, which may be marshalled to or from Haskell values
of type Ptr
aa
.
The type a
will often be an instance of class
Storable
which provides the marshalling operations.
However this is not essential, and you can provide your own operations
to access the pointer. For example you might write small foreign
functions to get or set the fields of a C struct
.
Instances
Eq (Ptr a) | Since: base-2.1 |
Ord (Ptr a) | Since: base-2.1 |
Show (Ptr a) | Since: base-2.1 |
Foldable (UAddr :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => UAddr m -> m # foldMap :: Monoid m => (a -> m) -> UAddr a -> m # foldMap' :: Monoid m => (a -> m) -> UAddr a -> m # foldr :: (a -> b -> b) -> b -> UAddr a -> b # foldr' :: (a -> b -> b) -> b -> UAddr a -> b # foldl :: (b -> a -> b) -> b -> UAddr a -> b # foldl' :: (b -> a -> b) -> b -> UAddr a -> b # foldr1 :: (a -> a -> a) -> UAddr a -> a # foldl1 :: (a -> a -> a) -> UAddr a -> a # elem :: Eq a => a -> UAddr a -> Bool # maximum :: Ord a => UAddr a -> a # minimum :: Ord a => UAddr a -> a # | |
Traversable (UAddr :: Type -> Type) | Since: base-4.9.0.0 |
Storable (Ptr a) | Since: base-2.1 |
Variant (Ptr a) Source # | |
Defined in System.Win32.Com.Automation inVariant :: ArgIn (Ptr a) Source # inVarList :: ArgIn [Ptr a] Source # inVarIUnknown :: ArgIn (IUnknown (Ptr a)) Source # vtEltType :: Ptr a -> VARENUM Source # resVariant :: ArgRes (Ptr a) Source # defaultVariant :: Ptr a Source # resVarList :: ArgRes [Ptr a] Source # |
A stable pointer is a reference to a Haskell expression that is guaranteed not to be affected by garbage collection, i.e., it will neither be deallocated nor will the value of the stable pointer itself change during garbage collection (ordinary references may be relocated during garbage collection). Consequently, stable pointers can be passed to foreign code, which can treat it as an opaque reference to a Haskell value.
A value of type StablePtr a
is a stable pointer to a Haskell
expression of type a
.
Instances
Eq (StablePtr a) | Since: base-2.1 |
Storable (StablePtr a) | Since: base-2.1 |
Defined in Foreign.Storable sizeOf :: StablePtr a -> Int # alignment :: StablePtr a -> Int # peekElemOff :: Ptr (StablePtr a) -> Int -> IO (StablePtr a) # pokeElemOff :: Ptr (StablePtr a) -> Int -> StablePtr a -> IO () # peekByteOff :: Ptr b -> Int -> IO (StablePtr a) # pokeByteOff :: Ptr b -> Int -> StablePtr a -> IO () # |
deRefStablePtr :: StablePtr a -> IO a #
Obtain the Haskell value referenced by a stable pointer, i.e., the
same value that was passed to the corresponding call to
newStablePtr
. If the argument to deRefStablePtr
has
already been freed using freeStablePtr
, the behaviour of
deRefStablePtr
is undefined.