I have this c function
GetR(
OUT ppp ** ppr,
OUT int * pn
)
with this strcuture
typedef struct ppp {
}ppp;
I marshalled like this:
[DllImport("NetApi.dll")]
public static extern int GetR(
[In,Out, MarshalAs(UnmanagedType.LPArray,SizeConst=256)]
IntPtr[] ppr,
out IntPtr pn
);
in my code i do this:
private IntPtr[] rrr = new IntPtr[10];
public int GetR()
{
int p=GetR(rrr,out j);
if(p==0)
{
for(int iii=0;iii<j.ToInt32();iii++)
{
oo = Marshal.PtrToStructure(rrr[iii],typeof(OB_RESOURCE));
}
}
}
It works fine for the first element, i mean, it only grabs the first
element, i know that there are 6 elements that the method have to
return but only the first is correctly retrieved.
I set breakpoints and inspect the rrr array and only the first element
have data.
Thanks
David Moreno
dmorenos@gmail.com - 13 Jan 2005 21:57 GMT
Sorry for the same name in the methods, obviusly
this piece of code is wrong:
public int GetRRRR()
\\\ the method name is different
{
int p=GetR(rrr,out j);
if(p==0)
{
for(int iii=0;iii<j.ToInt32();iii++)
{
oo = Marshal.PtrToStructure(rrr[iii],typeof(OB_RESOURCE));
}
}
}