DLL修改主程序传入的结构变量(指针)成员时出错
结构体定义 在dll和VC中均定义次结构
struct state
{
int Pos1, Pos2, Pos3, Pos4;
};
dll是用c++ builder写的
导出函数定义如下
extern "c" __declspec(dllexport) _cdecl GetPosInfo(struct state *info);
dll 函数体
extern "c" __declspec(dllexport) _cdecl GetPosInfo(struct state *info)
{
info->Pos1 = ..;
info->Pos2 = ..;
...
}
在VC中
{
struct state *POSINFO = new state;
POSINFo->Pos1 = ..;
....
GetPosInfo(POSINFO); =====>这一步会提示访问错误
...
}
同样dll中另外一个接口函数与这个函数类似,仅完成了char * 类型数据的传入,能够被dll正确使用,这个函数
也是采用的指针类型,但是会提示错误。
请问错误在什么地方?