Unbalanced Stack!

后端 未结 3 489

I have written a VC++ dll. The declaration for one of the methods in the dll is as follows:

extern \"C\" _declspec(dllexport)
void startIt(int number)
{
             


        
3条回答
  •  一向
    一向 (楼主)
    2020-12-11 05:18

    When you p/invoke an external function, the calling convention used defaults to __stdcall. Since your function uses the __cdecl convention, you need to declare it as such:

    [DllImport("Tracking.dll", EntryPoint = "startIt",
        CallingConvention = CallingConvention.Cdecl)]
    public extern static void startIt(int number);
    

提交回复
热议问题