1.在C++中
int X = 0xfff43843;
unsigned int Y = 0xfff43843
2.在C#中
int M = Convert.ToInt32("0xfff43843", 16);
uint N = 0xfff43843;
int X = 0xfff43843; //编译无法通过
但是我们将C++代码封装成Dll,用C#程序去调用就不是上述那样了
////////////////////////////封装方法////////////////////////////////////////
#define DllExport extern "C" __declspec(dllexport)
DllExport int TestFun()
{
int x = 0xfff43843;
return x;
}
C#调用:
[DllImport("T.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern int TestFun();
int x = TestFun();
MessageBox.Show(x.ToString());
Copyright © 2004-2024 Ynicp.com 版权所有 法律顾问:建纬(昆明)律师事务所 昆明市网翼通科技有限公司 滇ICP备08002592号-4