J
jurot
Hi.
I have struct in C++:
struct MY_STRUCT
{
int x;
int y;
char** arrNames; //array of strings
}
I have function GetMyStruct, which gives me pointer to this struct, but
I can't get the array of strings (MY_STRUCT.arrNames).
MY_STRUCT* GetMyStruct();
In C# :
public struct MY_STRUCT
{
public int x;
public int y;
public string[] arrNames; //array of strings
}
public class MyWrapper
{
[DllImport("MyDll.dll")]
private static extern IntPtr GetMyStruct();
public static MY_STRUCT GetMyStructW()
{
IntPtr p = GetMyStruct();
return (MY_STRUCT) Marshal.PtrToStructure(p, typeof(MY_STRUCT));
}
}
BUT MyWrapper.GetMyStructW() doesn't work. Plllease help.
I have struct in C++:
struct MY_STRUCT
{
int x;
int y;
char** arrNames; //array of strings
}
I have function GetMyStruct, which gives me pointer to this struct, but
I can't get the array of strings (MY_STRUCT.arrNames).
MY_STRUCT* GetMyStruct();
In C# :
public struct MY_STRUCT
{
public int x;
public int y;
public string[] arrNames; //array of strings
}
public class MyWrapper
{
[DllImport("MyDll.dll")]
private static extern IntPtr GetMyStruct();
public static MY_STRUCT GetMyStructW()
{
IntPtr p = GetMyStruct();
return (MY_STRUCT) Marshal.PtrToStructure(p, typeof(MY_STRUCT));
}
}
BUT MyWrapper.GetMyStructW() doesn't work. Plllease help.