急!!!从C#传递一个空的STRUCT到C++的DLL中,返回赋值后的此STRUCT问题!
从C#传递一个空的STRUCT到C++的DLL中,返回初始化(赋值)后的此STRUCT。
我如下做,
public struct WDBL_STRU
{
public int cc;
[ MarshalAs(UnmanagedType.LPStr,SizeConst=11)]
public string fz;
[ MarshalAs(UnmanagedType.LPStr,SizeConst=11)]
public string dz;
[ MarshalAs(UnmanagedType.ByValTStr,SizeConst=110)]
public string jy;
[ MarshalAs(UnmanagedType.LPStr,SizeConst=51)]
public string hz;
}
[DllImport("jzxdll.dll",EntryPoint="init_jzx")]
public static extern int init_jzx(out FB_STRU[] x,out WDBL_STRU[] y);
……
WDBL_STRU[] wdbl=new WDBL_STRU[500];
int bb=init_jzx(out wdbl);
但执行到这里就出错了!请教高手!