Copyright | (c) Daan Leijen leijen@@fwi.uva.nl 1998 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | sof@forkIO.com |
Stability | provisional |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
This module is part of HaskellDirect (H/Direct), providing helper functions over Ptrs + allocation/freeing of memory via malloc/free or the COM task allocator.
Synopsis
- data Ptr a
- allocMemory :: Word32 -> IO (Ptr a)
- stackFrame :: Word32 -> (Ptr a -> IO b) -> IO b
- writeSeqAtDec :: Word32 -> [Ptr a -> IO ()] -> Ptr a -> IO ()
- freeMemory :: Ptr a -> IO ()
- freeBSTR :: Ptr a -> IO ()
- freeWith :: (Ptr a -> IO ()) -> Ptr a -> IO ()
- freeWithC :: Finalizer () -> Ptr a -> IO ()
- primNoFree :: Ptr () -> IO ()
- finalNoFree :: Ptr ()
- finalFreeMemory :: Ptr ()
- makeFO :: Ptr a -> FunPtr (Ptr a -> IO ()) -> IO (ForeignPtr b)
Documentation
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 # |
stackFrame :: Word32 -> (Ptr a -> IO b) -> IO b Source #
Use stackFrame
when the allocated chunk have a
limited and known lifetime.
freeMemory :: Ptr a -> IO () Source #
primNoFree :: Ptr () -> IO () Source #
finalNoFree :: Ptr () Source #
finalFreeMemory :: Ptr () Source #