Hi
I have unmanaged code with following struct
struct DirList
{
char **elements /* [] */ ;
int32 *attributes /* [] */ ;
int64 *mtime /* [] */ ;
int64 *fsize /* [] */ ;
int32 num_elements ;
} ;
and the func is
Result MSWSTDCALL FT_dirList(SessionHandle *handle,const char *remoteDirName,DirList **dirlist,NBTicket *nbticket) ;
The code returns the dir list and sets num_elements to the number of elements in the char **element.
In the managed code, the struct I have defined
public struct DirList
{
public strinng[] elements /* [] */ ;
public int[] attributes /* [] */ ;
public int[] mtime /* [] */ ;
public int[] fsize /* [] */ ;
public int num_elements;
} ;
and the func is
[DllImport("a10.dll")]
public static extern Result FT_dirList(ref SessionHandle handle, string remoteDirName, out IntPtr dirlist, IntPtr nbticket);
I am calling the func in C# as
result = Class1.FT_dirList(ref session, "/", out outptr1, IntPtr.Zero);
and then trying to convert outptr(of type IntPtr) to DirList
dirlst = (Class1.DirList)Marshal.PtrToStructure(outptr1, typeof(Class1.DirList));
I am getting the following exception
Mismatch has occurred between the runtime type of the array and the sub type recorded in the metadata.
Any1 having ne idea what to do?
Regards
Aditya