Foreign.Marshal.Utils
Utilities for primitive marshaling
General marshalling utilities
Combined allocation and marshalling
with :: Storable a => a -> (Ptr a -> IO b) -> IO b Source #
executes the computation with
val ff
, 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.
Marshalling of Boolean values (non-zero corresponds to True
)
toBool :: (Eq a, Num a) => a -> Bool Source #
Convert a Boolean in numeric representation to a Haskell value
Marshalling of Maybe values
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