|
Foreign.Marshal.Utils | Portability | portable | Stability | provisional | Maintainer | ffi@haskell.org |
|
|
|
|
|
Description |
Utilities for primitive marshaling
|
|
Synopsis |
|
|
|
|
General marshalling utilities
|
|
Combined allocation and marshalling
|
|
|
with val f executes the computation f, passing as argument
a pointer to a temporarily allocated block of memory into which
val has been marshalled (the combination of alloca and poke).
The memory is freed when f terminates (either normally or via an
exception), so the pointer passed to f must not be used after this.
|
|
|
Allocate a block of memory and marshal a value into it
(the combination of malloc and poke).
The size of the area allocated is determined by the sizeOf
method from the instance of Storable for the appropriate type.
The memory may be deallocated using free or
finalizerFree when no longer required.
|
|
Marshalling of Boolean values (non-zero corresponds to True)
|
|
|
Convert a Haskell Bool to its numeric representation
|
|
|
Convert a Boolean in numeric representation to a Haskell value
|
|
Marshalling of Maybe values
|
|
|
Allocate storage and marshall a storable value wrapped into a Maybe
|
|
|
Converts a withXXX combinator into one marshalling a value wrapped
into a Maybe, using nullPtr to represent Nothing.
|
|
|
Convert a peek combinator into a one returning Nothing if applied to a
nullPtr
|
|
Marshalling lists of storable objects
|
|
withMany :: (a -> (b -> res) -> res) -> [a] -> ([b] -> res) -> res | Source |
|
Replicates a withXXX combinator over a list of objects, yielding a list of
marshalled objects
|
|
Haskellish interface to memcpy and memmove
|
|
(argument order: destination, source)
|
|
|
Copies the given number of bytes from the second area (source) into the
first (destination); the copied areas may not overlap
|
|
|
Copies the given number of bytes from the second area (source) into the
first (destination); the copied areas may overlap
|
|
Produced by Haddock version 0.9 |