-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Convenience functions for FFI work
--   
--   Add several functions missing in the standard Foreign modules:
--   
--   <ul>
--   <li>copy and move based on Storable</li>
--   <li>calloc</li>
--   </ul>
@package missing-foreign
@version 0.1.1


-- | Utilities for primitive marshaling
module Foreign.Marshal.MissingUtils

-- | Uses <a>sizeOf</a> to copy bytes from the second area (source) into
--   the first (destination); the copied areas may <i>not</i> overlap
copy :: Storable a => Ptr a -> Ptr a -> IO ()

-- | Uses <a>sizeOf</a> to copy bytes from the second area (source) into
--   the first (destination); the copied areas <i>may</i> overlap
move :: Storable a => Ptr a -> Ptr a -> IO ()


-- | The module <a>Foreign.Marshal.MissingAlloc</a> provides access to
--   <a>calloc</a> (e.g., allocated 0-initialized chunks of memory outside
--   of the Haskell storage manager).
--   
--   If any of these allocation functions fails, an exception is raised.
--   
--   The storage allocated is alligned to store any basic foreign types.
module Foreign.Marshal.MissingAlloc

-- | Allocate a block of memory that is sufficient to hold values of type
--   <tt>a</tt>. The size of the area allocated is determined by the
--   <a>sizeOf</a> method from the instance of <a>Storable</a> for the
--   appropriate type. The memory is initalized to 0.
--   
--   The memory may be deallocated using <tt>free</tt> or
--   <tt>finalizerFree</tt> when no longer required.
calloc :: Storable a => IO (Ptr a)

-- | Allocate a block of memory of the given number of bytes. The block of
--   memory is sufficiently aligned for any of the basic foreign tyes that
--   fit into a memory block of the allocated size. The memory is
--   initialized to 0.
--   
--   The memory may be deallocated using <tt>free</tt> or
--   <tt>finalizerFree</tt> when no longer required.
callocBytes :: Int -> IO (Ptr a)
