title: How can I pass MemoryStream data to unmanaged C++ DLL using P/Invoke
body: <p>I need your help with the following scenario:</p>
  <p>I am reading some data from hardware into a MemoryStream (C#) and I need to pass this data in memory to a dll implemented in unmanaged C++ (using pointer ??).
  The data read (into stream) is very large (megabytes). I understand that I can P/Invoke this dll but what I am not sure is how to pass the pointer / reference of the stream data to the C++ API ?</p>
  <p>I must admit I am confused as I am new to C# - do I need to use unsafe / fixed since data is large or these are irrelevant as MemoryStream object is managed by GC ? Some example code / detailed description would be very helpful. Thanks</p>
  <p>Signature of unmanaged API:</p>
  <pre><code>BOOL doSomething(void * rawData, int dataLength)
  </code></pre>