發表文章

目前顯示的是 8月, 2012的文章

C# 調用 C/C++ DLL 資料型態之對應

最近使用C#須呼叫win32 API 須用上一些資料轉換,在網路上蒐尋到一些文件先列出來 方便以後查詢 C++中的DLL函數原型為 extern "C" __declspec(dllexport) bool 方法名一(const char* 變數名稱1, unsigned char* 變數名稱 2) extern "C" __declspec(dllexport) bool 方法名二(const unsigned char* 變數名稱 1, char* 變數 名稱 2) C#調用C++的DLL搜集的資料型態轉換對應如下 c++:HANDLE(void   *)                                          ----    c#:System.IntPtr c++:Byte(unsigned   char)                                   ----    c#:System.Byte c++:SHORT(short)                                               ----    c#:System.Int16 c++:WORD(unsigned   short)                              ----    c#:System.UInt16 c++:INT(int)                                                          ----    c#:System.Int16 c++:INT(int)                                                          ----    c#:System.Int32 c++:UINT(unsigned   int)                                      ----    c#:System.UInt16 c++:UINT(unsigned   int)                                      ----    c#:System.UI