=================================
=================================
=================================
출처: https://www.displayfusion.com/Discussions/View/converting-c-data-types-to-c/?ID=38db6001-45e5-41a3-ab39-8004450204b3
If you've ever had to write any interop code to use an unmanaged library in your C# application, you know how tricky it can be to get the data types correct. I often find myself scouring the internet looking for the correct conversions, so I thought I would document everything I have learned so far. This is by no means a comprehensive list of all C++ data types, just the ones I find myself frequently writing interop code for.
C++ Type | C# Type | Size |
---|---|---|
BOOL | bool | 1 byte |
BYTE | byte | 1 byte |
CHAR | byte | 1 byte |
DECIMAL | Decimal | 16 bytes |
DOUBLE | double | 8 bytes |
DWORD | uint, UInt32 | 4 bytes |
FLOAT | float, single | 4 bytes |
INT, signed int | int, Int32 | 4 bytes |
INT16, signed short int | short, Int16 | 2 bytes |
INT32, signed int | int, Int32 | 4 bytes |
INT64 | long, Int64 | 8 bytes |
LONG | int, Int32 | 4 bytes |
LONG32, signed int | int, Int32 | 4 bytes |
LONG64 | long, Int64 | 8 bytes |
LONGLONG | long, Int64 | 8 bytes |
SHORT, signed short int | short, Int16 | 2 bytes |
UCHAR, unsigned char | byte | 1 byte |
UINT, unsigned int | uint, UInt32 | 4 bytes |
UINT16, WORD | ushort, UInt16 | 2 bytes |
UINT32, unsigned int | uint, UInt32 | 4 bytes |
UINT64 | ulong, UInt64 | 8 bytes |
ULONG, unsigned long | uint, UInt32 | 4 bytes |
ULONG32 | uint, UInt32 | 4 bytes |
ULONG64 | ulong, UInt64 | 8 bytes |
ULONGLONG | ulong, UInt64 | 8 bytes |
WORD | ushort | 2 bytes |
void*, pointers | IntPtr | x86=4 bytes, x64=8 bytes |
If I am missing something, or you would like me to include something else, please let me know in the comments below. Thanks!
=================================
=================================
=================================
'프로그래밍 관련 > 언어들의 코딩들 C++ JAVA C# 등..' 카테고리의 다른 글
[C#] Buffer.BlockCopy 으로 byte[] 데이터를 memmove, memcpy()처럼 이용 관련 (0) | 2019.03.13 |
---|---|
[C#] Sizeof, Marshal.SizeOf Method 형 크기 SizeOf 관련 (0) | 2019.03.13 |
[C#] 읽기/쓰기 속성 선언 및 사용 - get, set 사용 관련 (0) | 2019.03.12 |
[MFC] 다이얼로그를 전체화면, 최대화, 최소화, 원래대로 만들기 관련 (1) | 2017.09.14 |
C, C++ 시간 계산 관련 (0) | 2017.09.11 |
댓글 영역