对 PInvoke 函数“”的调用导致堆栈不对称

   [DllImport("DSStream.dll", EntryPoint = "DSStream_Initialize")]
        public static extern bool DSStream_Initialize();
        [DllImport("DSStream.dll", EntryPoint = "DSStream_Uninitialize")]
        public static extern void DSStream_Uninitialize();
        [DllImport("DSStream.dll", EntryPoint = "DSStream_ConnectDevice")]
        public static extern bool DSStream_ConnectDevice(int iCardID, bool bOverlay, IntPtr hParentWnd); 

 

 

bool num = SdkApi.DSStream_Initialize();
           

 SdkApi.DSStream_ConnectDevice(0, false, this.Handle);

对 PInvoke 函数“Demo!Demo.SdkApi::DSStream_ConnectDevice”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配

 

 

CallingConvention = CallingConvention.Cdecl 解决 .net 4

你可能感兴趣的:(对 PInvoke 函数“”的调用导致堆栈不对称)