吃水果不削皮 2017-05-31 08:49
浏览 524
已结题

关于c#调用c++dll中结构体相关问题

c#中:[DllImport("footDLL.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public extern static void sc();

c++dll中:extern"C" {
_declspec(dllexport) void __stdcall sc() {
A a(1, 2);
a.add();
ofstream fout;
fout.open("E:\test6.txt");
fout << "TRUE" << endl << a.gre();
fout.close();
system("pause");
}
}
其中头文件:
typedef struct {
int x[max_vertex_num][max_vertex_num];
string str[max_vertex_num];
double sd[max_vertex_num];
}s;
class A {
public:
A(int x, int y) {
this->x = x;
this->y = y;
}
void add() {
x = x + y;
}
int gre() {
return this->x;
}
private:
int x;
int y;
listnode *l;
s d;
//Mgragh g;
}

为什么dll中结构体s是x数组从一维数组编程二维数组后,c#调用dll函数出现“System.StackOverflowException”类型的未经处理的异常在 Route.exe 中发生 这种BUG,怎么解决?

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!