{C++ 基礎} {C++ 高級} {C#界面,C++核心算法} {設計模式} {C#基礎}
三,其他
對于COM,在托管代碼和非托管代碼之間進行的所有調用都必須滿足各自編程模型強加的要求。托管和非托管編程模型在很多方面是不同的。下表顯示了每個模型的定義特征。
代碼模型
基于接口
基于對象
標識
GUID
強名稱
錯誤處理機制
HRESULT
異常
類型兼容性
二進制標準
類型標準
類型定義
類型庫
元數據
類型安全
非類型安全
可選安全
版本控制
不可變的
靈活的
bool
bool *
System.Int32
char、small
char *、small *
System.SByte
short
short *
System.Int16
long、int
long *、int *
Hyper
hyper *
System.Int64
unsigned char、byte
unsigned char *、byte *
System.Byte
wchar_t、unsigned short
wchar_t *、unsigned short *
System.UInt16
unsigned long、unsigned int
unsigned long *、unsigned int *
System.UInt32
unsigned hyper
unsigned hyper *
System.UInt64
float
float *
System.Single
double
double *
System.Double
VARIANT_BOOL
VARIANT_BOOL *
System.Boolean
void*
void **
System.IntPtr
HRESULT *
System.Int16 或 System.IntPtr
SCODE
SCODE *
BSTR
BSTR *
System.String
LPSTR 或 [string, ...] char *
LPSTR *
LPWSTR 或 [string, …] wchar_t *
LPWSTR *
VARIANT
VARIANT *
System.Object
DECIMAL
DECIMAL *
System.Decimal
DATE
DATE *
System.DateTime
GUID *
System.Guid
CURRENCY
CURRENCY *
IUnknown *
IUnknown **
IDispatch *
IDispatch **
SAFEARRAY( type )
SAFEARRAY( type ) *
type []
http://www.voidnish.com/articles/ShowArticle.aspx?code=StringConvertor
posted on 2007-05-29 13:55 夢在天涯 閱讀(5205) 評論(3) 編輯 收藏 引用 所屬分類: CPlusPlus 、Manage c++ /CLI
好東西餓,支持 回復 更多評論
非托管 C 語言類型 托管類名 說明 HANDLE void* System.IntPtr 32 位 BYTE unsigned char S ystem.Byte 8 位 SHORT short System.Int16 16 位 WORD unsigned short System.UInt16 16 位 INT int System.Int32 32 位 UINT unsigned int System.UInt32 32 位 LONG long System.Int32 32 位 BOOL bool System.BOOL 8 位 DWORD unsigned long System.UInt32 32 位 ULONG unsigned long System.UInt32 32 位 CHAR char System.Char 用 ANSI 修飾。 LPSTR char* System.String 或 System.StringBuilder 用 ANSI 修飾。 LPCSTR Const char* System.String 或 System.StringBuilder 用 ANSI 修飾。 LPWSTR wchar_t* System.String 或 System.StringBuilder 用 Unicode 修飾。 LPCWSTR Const wchar_t* System.String 或 System.StringBuilder 用 Unicode 修飾。 FLOAT Float System.Single 32 位 DOUBLE Double System.Double 64 位 回復 更多評論
msdn 上: BOOL long System.Int32 32 位 回復 更多評論