首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

c#进展调用c++封装程序

2012-09-12 
c#进行调用c++封装程序c++ 进行封装DLL_EXPORT int JSD_Login(int a,int b){return JSD_RealPlay(a,b)}c#

c#进行调用c++封装程序
c++ 进行封装
DLL_EXPORT int JSD_Login(int a,int b)
{
return JSD_RealPlay(a,b);
}

c#进行调用
  [System.Runtime.InteropServices.DllImport("test")]
  private static extern int JSD_Login(int a, int b);

  int c = JSD_Login(a, b);
报异常
对 PInvoke 函数“View!View.Calculate::JSD_Login”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配


[解决办法]
[System.Runtime.InteropServices.DllImport("test")]
 改成
[System.Runtime.InteropServices.DllImport("test",CallingConvention=CallingConvention.Cdecl)]

热点排行