IMO, you need marshal it by yourself.
There is no support for marshaling a variable length structure.
You may define the parameter as IntPtr, then use the methods in Marshal
class (e.g. Marshal.ReadInt32/ Marshal.Copy etc) to copy the array to
managed object.

Ying-Shen
-----Original Message-----
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Kohli, Naveen
Sent: 2004年7月6日 22:12
To: [EMAIL PROTECTED]
Subject: [other] [ADVANCED-DOTNET] Marshal Embedded arrays in structure

I have a C structure like this...

typedef struct MyData
{
  uint uisomeOtherValue;
  int iOneMoreValue;
  ushort usSize;
  uint uiValues[1];
}

The first parameter is size of the array that will be returned from the
C
DLL.

How do you implement the marshalling code to get all the elements in the
returned array inside this structure?

Thanks!

===================================
This list is hosted by DevelopMentor.  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor? http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to