Marshaling an array of IntPtrs in C#
Posted
by mcoolbeth
on Stack Overflow
See other posts from Stack Overflow
or by mcoolbeth
Published on 2010-04-07T19:40:09Z
Indexed on
2010/04/07
19:43 UTC
Read the original article
Hit count: 461
From safe, managed code in C#, I would like to call a function in a C API that receives an array of pointers (void**).
I have the corresponding managed array of IntPtr objects, but the Marshal methods advertised in the documentation at MSDN do not seem sufficient to provide and IntPtr to an unmanaged block of memory with the correct content.
I had hoped to obtain an IntPtr with 'Marshal.AllocHGlobal' and then assign the correct content using 'Marshal.Copy', but it seems the function has not been overloaded for an array of IntPtr.
Any thoughts on the best way to do this?
Thanks in advance.
© Stack Overflow or respective owner