我编写了完整的 native C++ 代码 dll,我想使用 P/Invoke 通过 C# 代码调用他的方法。 我是否需要为此更改 native dll 的属性?
最佳答案
P/Invoking 需要 stdcall 约定。因此,请查看您的所有函数声明是否都以 __stdcall 开头。否则堆栈会损坏。
另请参阅 PInvokeStackImbalance C# call to unmanaged C++ function
关于c# - 从 C# 代码调用 C++ native dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10899200/