C# delegate for C++ callback

前端 未结 3 1066
北恋
北恋 2021-01-04 13:02

I think I have basically understood how to write c# delegates for callbacks, but this one is confusing me. The c++ definition is as follows:

typedef int (__s         


        
3条回答
  •  青春惊慌失措
    2021-01-04 13:17

    [UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
    unsafe delegate int CallbackDelegate (int lCode, int lParamSize, IntPtr pParam);
    

    If .NET assumes cdecl instead of stdcall, your stack will most assuredly be hosed.

提交回复
热议问题