【发布时间】:2021-04-06 04:15:33
【问题描述】:
在将 char 数组数据从 C++ 导出到 C# 时,我收到了检测到堆损坏的错误。
C++ 代码
extern "C" __declspec(dllexport) void __cdecl Table(char RetData[5]))
{
---
//Getting data in list
----
std::list<structureData>::iterator it = list.begin();
RetData = it->data;
}
C#代码
// dll import code
public void DbData()
{
char[] retValue = new char[5];
Table(retValue);
}
有人可以帮助它为什么会抛出错误以及我必须做哪些更改
【问题讨论】: