passing pointers referencing memory allocated in managed code to unmanaged
<p>I have a large char[] buffer allocated in c# and want to pass a pointer to this data to an umnanaged c function in a DLL.</p>

<p>Now i think for this to work the char buffer must be FIXED so that GC cant shift it around while the function is working.</p>

<p>If so, would i declare the buffer FIXED and call the DLL within and UNSAFE block ??</p>

<pre><code>fixed ( int* p = &amp;bigbuffer )
{
    processbigbuffer(bigbuffer); 
}
</code></pre>

<p>I have searched but not many references highlight the issue that the memory belongs to c# and how this would work in a DLL.</p>

<p>Thanks</p>
