评论

收藏

[C++] Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 解决

编程语言 编程语言 发布于:2021-07-21 20:25 | 阅读数:334 | 评论:0

Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in
because regular C functions work differently than the Windows API functions; their "calling conventions" are different, meaning how they pass around parameters is different. (This was hinted at in the error.)
所以请在C#中 使用CallingConvention = CallingConvention.Cdecl),代码如下:
[DllImport("CommonNativeLib.dll", CallingConvention = CallingConvention.Cdecl)]或者 在C++中:
extern "C" __declspec(dllexport) int __stdcall Add(int a, int b) ...
 
关注下面的标签,发现更多相似文章