<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Foreign.ForeignPtr</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Foreign-ForeignPtr.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">haskell2010-1.1.0.1: Compatibility with Haskell 2010</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr></table><p class="caption">Foreign.ForeignPtr</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Finalised data pointers </a><ul><li><a href="#g:2">Basic operations </a></li><li><a href="#g:3">Low-level operations </a></li><li><a href="#g:4">Allocating managed memory </a></li></ul></li></ul></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:ForeignPtr">ForeignPtr</a> a</li><li class="src short"><span class="keyword">type</span> <a href="#t:FinalizerPtr">FinalizerPtr</a> a = <a href="Foreign-Ptr.html#t:FunPtr">FunPtr</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> ())</li><li class="src short"><span class="keyword">type</span> <a href="#t:FinalizerEnvPtr">FinalizerEnvPtr</a> env a = <a href="Foreign-Ptr.html#t:FunPtr">FunPtr</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> env -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> ())</li><li class="src short"><a href="#v:newForeignPtr">newForeignPtr</a> :: <a href="Foreign-ForeignPtr.html#t:FinalizerPtr">FinalizerPtr</a> a -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</li><li class="src short"><a href="#v:newForeignPtr_">newForeignPtr_</a> :: <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</li><li class="src short"><a href="#v:addForeignPtrFinalizer">addForeignPtrFinalizer</a> :: <a href="Foreign-ForeignPtr.html#t:FinalizerPtr">FinalizerPtr</a> a -> <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Prelude.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:newForeignPtrEnv">newForeignPtrEnv</a> :: <a href="Foreign-ForeignPtr.html#t:FinalizerEnvPtr">FinalizerEnvPtr</a> env a -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> env -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</li><li class="src short"><a href="#v:addForeignPtrFinalizerEnv">addForeignPtrFinalizerEnv</a> :: <a href="Foreign-ForeignPtr.html#t:FinalizerEnvPtr">FinalizerEnvPtr</a> env a -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> env -> <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Prelude.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:withForeignPtr">withForeignPtr</a> :: <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> b) -> <a href="Prelude.html#t:IO">IO</a> b</li><li class="src short"><a href="#v:finalizeForeignPtr">finalizeForeignPtr</a> :: <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Prelude.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:unsafeForeignPtrToPtr">unsafeForeignPtrToPtr</a> :: <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a</li><li class="src short"><a href="#v:touchForeignPtr">touchForeignPtr</a> :: <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Prelude.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:castForeignPtr">castForeignPtr</a> :: <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> b</li><li class="src short"><a href="#v:mallocForeignPtr">mallocForeignPtr</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a => <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</li><li class="src short"><a href="#v:mallocForeignPtrBytes">mallocForeignPtrBytes</a> :: <a href="Prelude.html#t:Int">Int</a> -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</li><li class="src short"><a href="#v:mallocForeignPtrArray">mallocForeignPtrArray</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a => <a href="Prelude.html#t:Int">Int</a> -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</li><li class="src short"><a href="#v:mallocForeignPtrArray0">mallocForeignPtrArray0</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a => <a href="Prelude.html#t:Int">Int</a> -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</li></ul></div><div id="interface"><h1 id="g:1">Finalised data pointers </h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:ForeignPtr" class="def">ForeignPtr</a> a <a href="../base-4.5.1.0/src/GHC-ForeignPtr.html#ForeignPtr" class="link">Source</a></p><div class="doc"><p>The type <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code> represents references to objects that are maintained in a foreign language, i.e., that are not part of the data structures usually managed by the Haskell storage manager. The essential difference between <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code>s and vanilla memory references of type <code>Ptr a</code> is that the former may be associated with <em>finalizers</em>. A finalizer is a routine that is invoked when the Haskell storage manager detects that - within the Haskell heap and stack - there are no more references left that are pointing to the <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code>. Typically, the finalizer will, then, invoke routines in the foreign language that free the resources bound by the foreign object. </p><p>The <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code> is parameterised in the same way as <code><a href="Foreign-Ptr.html#t:Ptr">Ptr</a></code>. The type argument of <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code> should normally be an instance of class <code><a href="Foreign-Storable.html#t:Storable">Storable</a></code>. </p></div><div class="subs instances"><p id="control.i:ForeignPtr" class="caption collapser" onclick="toggleSection('i:ForeignPtr')">Instances</p><div id="section.i:ForeignPtr" class="show"><table><tr><td class="src"><a href="../base-4.5.1.0/Data-Typeable-Internal.html#t:Typeable1">Typeable1</a> <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Prelude.html#t:Eq">Eq</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Prelude.html#t:Ord">Ord</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Prelude.html#t:Show">Show</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:FinalizerPtr" class="def">FinalizerPtr</a> a = <a href="Foreign-Ptr.html#t:FunPtr">FunPtr</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> ())<a href="../base-4.5.1.0/src/GHC-ForeignPtr.html#FinalizerPtr" class="link">Source</a></p><div class="doc"><p>A finalizer is represented as a pointer to a foreign function that, at finalisation time, gets as an argument a plain pointer variant of the foreign pointer that the finalizer is associated with. </p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:FinalizerEnvPtr" class="def">FinalizerEnvPtr</a> env a = <a href="Foreign-Ptr.html#t:FunPtr">FunPtr</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> env -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> ())<a href="../base-4.5.1.0/src/GHC-ForeignPtr.html#FinalizerEnvPtr" class="link">Source</a></p></div><h2 id="g:2">Basic operations </h2><div class="top"><p class="src"><a name="v:newForeignPtr" class="def">newForeignPtr</a> :: <a href="Foreign-ForeignPtr.html#t:FinalizerPtr">FinalizerPtr</a> a -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)<a href="../base-4.5.1.0/src/Foreign-ForeignPtr-Imp.html#newForeignPtr" class="link">Source</a></p><div class="doc"><p>Turns a plain memory reference into a foreign pointer, and associates a finalizer with the reference. The finalizer will be executed after the last reference to the foreign object is dropped. There is no guarantee of promptness, however the finalizer will be executed before the program exits. </p></div></div><div class="top"><p class="src"><a name="v:newForeignPtr_" class="def">newForeignPtr_</a> :: <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)<a href="../base-4.5.1.0/src/GHC-ForeignPtr.html#newForeignPtr_" class="link">Source</a></p><div class="doc"><p>Turns a plain memory reference into a foreign pointer that may be associated with finalizers by using <code><a href="Foreign-ForeignPtr.html#v:addForeignPtrFinalizer">addForeignPtrFinalizer</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:addForeignPtrFinalizer" class="def">addForeignPtrFinalizer</a> :: <a href="Foreign-ForeignPtr.html#t:FinalizerPtr">FinalizerPtr</a> a -> <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Prelude.html#t:IO">IO</a> ()<a href="../base-4.5.1.0/src/GHC-ForeignPtr.html#addForeignPtrFinalizer" class="link">Source</a></p><div class="doc"><p>This function adds a finalizer to the given foreign object. The finalizer will run <em>before</em> all other finalizers for the same object which have already been registered. </p></div></div><div class="top"><p class="src"><a name="v:newForeignPtrEnv" class="def">newForeignPtrEnv</a> :: <a href="Foreign-ForeignPtr.html#t:FinalizerEnvPtr">FinalizerEnvPtr</a> env a -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> env -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)<a href="../base-4.5.1.0/src/Foreign-ForeignPtr-Imp.html#newForeignPtrEnv" class="link">Source</a></p><div class="doc"><p>This variant of <code><a href="Foreign-ForeignPtr.html#v:newForeignPtr">newForeignPtr</a></code> adds a finalizer that expects an environment in addition to the finalized pointer. The environment that will be passed to the finalizer is fixed by the second argument to <code><a href="Foreign-ForeignPtr.html#v:newForeignPtrEnv">newForeignPtrEnv</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:addForeignPtrFinalizerEnv" class="def">addForeignPtrFinalizerEnv</a> :: <a href="Foreign-ForeignPtr.html#t:FinalizerEnvPtr">FinalizerEnvPtr</a> env a -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> env -> <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Prelude.html#t:IO">IO</a> ()<a href="../base-4.5.1.0/src/GHC-ForeignPtr.html#addForeignPtrFinalizerEnv" class="link">Source</a></p><div class="doc"><p>Like <code><a href="Foreign-ForeignPtr.html#v:addForeignPtrFinalizerEnv">addForeignPtrFinalizerEnv</a></code> but allows the finalizer to be passed an additional environment parameter to be passed to the finalizer. The environment passed to the finalizer is fixed by the second argument to <code><a href="Foreign-ForeignPtr.html#v:addForeignPtrFinalizerEnv">addForeignPtrFinalizerEnv</a></code> </p></div></div><div class="top"><p class="src"><a name="v:withForeignPtr" class="def">withForeignPtr</a> :: <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="Prelude.html#t:IO">IO</a> b) -> <a href="Prelude.html#t:IO">IO</a> b<a href="../base-4.5.1.0/src/Foreign-ForeignPtr-Imp.html#withForeignPtr" class="link">Source</a></p><div class="doc"><p>This is a way to look at the pointer living inside a foreign object. This function takes a function which is applied to that pointer. The resulting <code><a href="Prelude.html#t:IO">IO</a></code> action is then executed. The foreign object is kept alive at least during the whole action, even if it is not used directly inside. Note that it is not safe to return the pointer from the action and use it after the action completes. All uses of the pointer should be inside the <code><a href="Foreign-ForeignPtr.html#v:withForeignPtr">withForeignPtr</a></code> bracket. The reason for this unsafeness is the same as for <code><a href="../base-4.5.1.0/Foreign-ForeignPtr-Unsafe.html#v:unsafeForeignPtrToPtr">unsafeForeignPtrToPtr</a></code> below: the finalizer may run earlier than expected, because the compiler can only track usage of the <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code> object, not a <code><a href="Foreign-Ptr.html#t:Ptr">Ptr</a></code> object made from it. </p><p>This function is normally used for marshalling data to or from the object pointed to by the <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code>, using the operations from the <code><a href="Foreign-Storable.html#t:Storable">Storable</a></code> class. </p></div></div><div class="top"><p class="src"><a name="v:finalizeForeignPtr" class="def">finalizeForeignPtr</a> :: <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Prelude.html#t:IO">IO</a> ()<a href="../base-4.5.1.0/src/GHC-ForeignPtr.html#finalizeForeignPtr" class="link">Source</a></p><div class="doc"><p>Causes the finalizers associated with a foreign pointer to be run immediately. </p></div></div><h2 id="g:3">Low-level operations </h2><div class="top"><p class="src"><a name="v:unsafeForeignPtrToPtr" class="def">unsafeForeignPtrToPtr</a> :: <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a<a href="../base-4.5.1.0/src/Foreign-ForeignPtr.html#unsafeForeignPtrToPtr" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:touchForeignPtr" class="def">touchForeignPtr</a> :: <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Prelude.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p><div class="doc"><p>This function ensures that the foreign object in question is alive at the given place in the sequence of IO actions. In particular <code><a href="Foreign-ForeignPtr.html#v:withForeignPtr">withForeignPtr</a></code> does a <code><a href="Foreign-ForeignPtr.html#v:touchForeignPtr">touchForeignPtr</a></code> after it executes the user action. </p><p>Note that this function should not be used to express dependencies between finalizers on <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code>s. For example, if the finalizer for a <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code> <code>F1</code> calls <code><a href="Foreign-ForeignPtr.html#v:touchForeignPtr">touchForeignPtr</a></code> on a second <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code> <code>F2</code>, then the only guarantee is that the finalizer for <code>F2</code> is never started before the finalizer for <code>F1</code>. They might be started together if for example both <code>F1</code> and <code>F2</code> are otherwise unreachable. </p><p>In general, it is not recommended to use finalizers on separate objects with ordering constraints between them. To express the ordering robustly requires explicit synchronisation between finalizers. </p></div></div><div class="top"><p class="src"><a name="v:castForeignPtr" class="def">castForeignPtr</a> :: <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> b<a href="../base-4.5.1.0/src/GHC-ForeignPtr.html#castForeignPtr" class="link">Source</a></p><div class="doc"><p>This function casts a <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code> parameterised by one type into another type. </p></div></div><h2 id="g:4">Allocating managed memory </h2><div class="top"><p class="src"><a name="v:mallocForeignPtr" class="def">mallocForeignPtr</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a => <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)</p><div class="doc"><p>Allocate some memory and return a <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code> to it. The memory will be released automatically when the <code><a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a></code> is discarded. </p><p><code><a href="Foreign-ForeignPtr.html#v:mallocForeignPtr">mallocForeignPtr</a></code> is equivalent to </p><pre> do { p <- malloc; newForeignPtr finalizerFree p } </pre><p>although it may be implemented differently internally: you may not assume that the memory returned by <code><a href="Foreign-ForeignPtr.html#v:mallocForeignPtr">mallocForeignPtr</a></code> has been allocated with <code><a href="../base-4.5.1.0/Foreign-Marshal-Alloc.html#v:malloc">malloc</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:mallocForeignPtrBytes" class="def">mallocForeignPtrBytes</a> :: <a href="Prelude.html#t:Int">Int</a> -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)<a href="../base-4.5.1.0/src/GHC-ForeignPtr.html#mallocForeignPtrBytes" class="link">Source</a></p><div class="doc"><p>This function is similar to <code><a href="../base-4.5.1.0/Foreign-ForeignPtr-Safe.html#v:mallocForeignPtr">mallocForeignPtr</a></code>, except that the size of the memory required is given explicitly as a number of bytes. </p></div></div><div class="top"><p class="src"><a name="v:mallocForeignPtrArray" class="def">mallocForeignPtrArray</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a => <a href="Prelude.html#t:Int">Int</a> -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)<a href="../base-4.5.1.0/src/Foreign-ForeignPtr-Imp.html#mallocForeignPtrArray" class="link">Source</a></p><div class="doc"><p>This function is similar to <code><a href="../base-4.5.1.0/Foreign-Marshal-Array.html#v:mallocArray">mallocArray</a></code>, but yields a memory area that has a finalizer attached that releases the memory area. As with <code><a href="../base-4.5.1.0/Foreign-ForeignPtr-Safe.html#v:mallocForeignPtr">mallocForeignPtr</a></code>, it is not guaranteed that the block of memory was allocated by <code><a href="../base-4.5.1.0/Foreign-Marshal-Alloc.html#v:malloc">malloc</a></code>. </p></div></div><div class="top"><p class="src"><a name="v:mallocForeignPtrArray0" class="def">mallocForeignPtrArray0</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a => <a href="Prelude.html#t:Int">Int</a> -> <a href="Prelude.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr.html#t:ForeignPtr">ForeignPtr</a> a)<a href="../base-4.5.1.0/src/Foreign-ForeignPtr-Imp.html#mallocForeignPtrArray0" class="link">Source</a></p><div class="doc"><p>This function is similar to <code><a href="../base-4.5.1.0/Foreign-Marshal-Array.html#v:mallocArray0">mallocArray0</a></code>, but yields a memory area that has a finalizer attached that releases the memory area. As with <code><a href="../base-4.5.1.0/Foreign-ForeignPtr-Safe.html#v:mallocForeignPtr">mallocForeignPtr</a></code>, it is not guaranteed that the block of memory was allocated by <code><a href="../base-4.5.1.0/Foreign-Marshal-Alloc.html#v:malloc">malloc</a></code>. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>