让我们举一个例子:
BOOL MessageBeep(UINT uType); // from User32.dll
投入参数是UINT,以具体说明整形类型,即32比特和64比特分类,取决于我们称之为的Windows版本(或我错了?)。
如果我想从C#中获取P/Invoke信息,那么我就适用《驱逐宣言》:
[DllImport("User32.dll")]
static extern Boolean MessageBeep(UInt32 beepType);
该代码C#在Windows x64下的工作吗?
- If yes, why is it OK to invoke the call a 32bit integer, while a 64bit integer is expected (assuming that I am correct on this)?
- If no, how should the proper platform agnostic P/Invoke declaration look like in C#?