Thanks for the link. I was trying to avoid the manual marshalling of the data. Now I
have run into a different problem. Here is what the prototype looks like.
[StructLayout(LayoutKind.Sequential)]
internal class MY_DATA
{
internal UInt16 usData1;
internal UInt32 uiSize;
internal IntPtr usValues;
}
Now I try to get the values out..
IntPtr pData = ...< this I got from C DLL > ...
UInt16 usData1 = Marshal.ReadInt16(pData); ---> This returns the correct value
Now I want to read uiSize member,
UInt32 uiSize = Marshal.ReadInt32(pData, 2); --> This gives wrong value.
UInt32 uiSize = Marshal.ReadInt32(pData, 4); --> This is OK..
Isn't the offset for UInt16 2bytes.. or I am totally mistaken.
-----Original Message-----
From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On
Behalf Of Mattias Sj�gren
Sent: Tuesday, July 06, 2004 10:47 AM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Marshal Embedded arrays in structure
>How do you implement the marshalling code to get all the elements in the
>returned array inside this structure?
See if this helps
http://www.dotnetinterop.com/faq/?q=VariableLengthStruct
Mattias
--
Mattias Sj�gren
[EMAIL PROTECTED]
===================================
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