在使用托管代码调用非托管代码时,发生“对 PInvoke 函数“UseTwiHikVisionDllTest!UseTwiHikVisionDllTest.TwiHikVision::GetFirstPic”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。

解决方法:

     添加属性:CallingConvention=CallingConvention.Cdecl
如:
        [DllImport("TwiHikVision.dll", EntryPoint="GetFirstPic",CallingConvention=CallingConvention.Cdecl)]
        public static extern string GetFirstPic(string videoFileName, string exportFilePath);

相关文章:

  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2021-11-28
  • 2022-01-07
  • 2021-12-15
猜你喜欢
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2021-12-07
相关资源
相似解决方案