how to pass pointer to c++ structure to c# and read this structure further?
<p>In c# I have following callback</p>

<pre><code>    [UnmanagedFunctionPointer(CallingConvention.StdCall)]
    public delegate void SnapshotOrdersIncrementalCallback(int value);
</code></pre>

<p>I pass <code>int</code> value only for test, I actually want to pass pointer to such c++ structure</p>

<pre><code>struct OrderUpdate {
uint32_t instrumentId;
uint32_t MDEntryID;
uint32_t MDUpdateAction;
double /*decimal*/ MDEntryPx;
double /*decimal*/ MDEntrySize;
uint32_t RptSeq;
uint32_t MDEntryTime;
uint32_t OrigTime;
char MDEntryType;
};
</code></pre>

<p>How can I do that? I've tried to replace <code>int</code> with <code>void*</code> (completely not sure if this is correct, just testing):</p>

<pre><code>    [UnmanagedFunctionPointer(CallingConvention.StdCall)]
    public delegate void SnapshotOrdersIncrementalCallback(void* value);
</code></pre>

<p>But then I receive <code>Pointers and fixed size buffers may only be used in an unsafe context</code> error.</p>

<p>I guess probaly I should replace <code>int</code> with <code>long</code> and then I can pass pointer as <code>long</code>? How can I have structure fields is another question...</p>
