I have a struct defined as
struct DiskInfo{
int size,
char **atributes
};
I need to sent it to c++ dll that will run something like
for(i=0;i<Files.count;i++)
{
newList[i] = (wchar_t *)malloc(sizeof(List->Strings[i]));
wcscpy(newList[i], List->Strings[i]);
.... more code
}
At this point I have the struct poplutaed will all the data, and i need to send it back to c#. I tried:
internal struct DiskInfo
{
internal int size;
[MarshalAs(UnmanagedType.ByValArray)]
internal string[] Files;
}
and the signature is
[DllImport("Disk.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = GetDiskInfo")]
internal static extern uint GetDiskInfo(
[In, Out]
DiskInfo Param);
And call to function
data= new DiskInfo();
Native.GetDiskInfo(data);
However, data is always returned as null. What am I doing wrong?