急!!!从C#传递一个空的STRUCT到C++的DLL中,返回赋值后的此STRUCT问题!

hb9191 2004-03-04 10:33:15
从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);

但执行到这里就出错了!请教高手!
...全文
110 37 打赏 收藏 转发到动态 举报
写回复
用AI写文章
37 条回复
切换为时间正序
请发表友善的回复…
发表回复

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧