2013年3月18日 星期一

C , C++ , C# 型態對照表


Conclusion在C#與C/C++作interop時,最重要的就是兩個語言型別的對應,整理如下:

Unmanage type in Wtypes.hUnmanaged C typeManaged class nameManaged C# typeDescription
HANDLEvoid *System.InPtrN/A32 bits on 32-bit windows operation systems, 64 bits on 64-bit windows operation systems.
BYTEunsigned charSystem.Bytebyte8 bits
SHORTshortSystem.Int16short16 bits
WORDunsigned shortSystem.UInt16ushort16 bits
INTintSystem.Int32int32 bits
UINTunsigned intSystem.UInt32uint32 bits
LONGlongSystem.Int32int32 bits
BOOLlongSystem.Int32int32 bits
DWORDunsigned longSystem.Int32int32 bits
ULONGunsigned longSystem.Int32int32 bits
CHARcharSystem.CharcharDecorate with ANSI
LPSTRchar *System.String or System.Text.StringBuilderstringDecorate with ANSI
LPCSTRconst char *System.String or System.Text.StringBuilderstringDecorate with ANSI
LPWSTRwchar_t*System.String or System.Text.StringBuilderstringDecorate with ANSI
LPCWSTRconst wchar_t*System.String or System.Text.StringBuilderstringDecorate with ANSI
FLOATFloatSystem.Singlefloat32 bits
DUOBLEDoubleSystem.Doubledouble64 bits

沒有留言:

張貼留言