Re: P/invoke an array of structs with embedded char* buffers
- From: Mattias Sjögren <mattias.dont.want.spam@xxxxxxxx>
- Date: Sat, 31 Mar 2007 00:59:55 +0200
int CaptureMultiple( CapBuffer ** capBufferArr, unsigned int
numBuffer ..)
Buffer's 1, 2 & 3 are to be preallocated to 20000 bytes, and the dll
will populate these buffers.
I pass the arrray to structs parameter as:
internal static extern int CaptureMultiple( [In, Out] CapBuffer[]
capBufferArr, UInt32 numBuffers...)
Using CapBuffer[] as the parameter type will effectively give you a
CapBuffer* on the native side. You need one more level of indirection
to match the original signature.
[MarshalAs(UnmanagedType.SysUInt)]
public IntPtr Buffer1;
This is what I'd use.
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
.
- References:
- Prev by Date: Re: c# class registered as com class, default register value
- Next by Date: Re: Sending chars between VB6 and C#.NET
- Previous by thread: P/invoke an array of structs with embedded char* buffers
- Next by thread: Re: c# class registered as com class, default register value
- Index(es):