A call to PInvoke function has unbalanced the stack when including a C DLL into C#

前端 未结 3 2188
攒了一身酷
攒了一身酷 2021-01-06 12:56

I have written a C DLL and some C# code to test including this DLL and executing functions from it. I am not too familiar with this process, and am receiving a PInvokeStackI

3条回答
  •  盖世英雄少女心
    2021-01-06 13:20

    In C++ a long is 32 bit. In C# it's 64 bit. Use int in your C# declaration.

    You could also try adding __stdcall to the C++ function. See: What is __stdcall?

提交回复
热议问题