我以为问题出在我的C ++函数内部,但是我尝试了
C ++ dll中的C ++函数:
bool __declspec( dllexport ) OpenA(std::string file)
{
return true;
}
C#代码:
[DllImport("pk2.dll")]
public static extern bool OpenA(string path);
if (OpenA(@"E:\asdasd\"))
我发现内存损坏了,为什么?
如果我删除了std :: string参数,则效果很好,但使用std :: string则不起作用。
慕丝7291255