c 呼叫dll型別對應表

2021-04-08 12:47:39 字數 3301 閱讀 3059

c#

呼叫dll

檔案時引數對應表

wtypes.h

中的非託管型別

非託管 c

語言型別

託管類名 說明

handle

void*

system.intptr

32 位

byte

unsigned char

system.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

long

system.int32

32 位

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 位類別

類名 說明

visual basic

資料型別

c#

資料型別

c++

託管擴充套件資料型別

jscript

資料型別 整數

byte

8 位的無符號整數。

byte

byte

char

byte

sbyte

8 位的有符號整數。

不符合 cls。

sbyte

無內建型別。

sbyte

signed char

sbyte

int16

16 位的有符號整數。

short

short

short

short

int32

32 位的有符號整數。

integer

int

int

- 或 -

long

int

int64

64 位的有符號整數。

long

long

__int64

long

uint16

16 位的無符號整數。

不符合 cls。

uint16

無內建型別。

ushort

unsigned short

uint16

uint32

32 位的無符號整數。

不符合 cls。

uint32

無內建型別。

uint

unsigned int

- 或 -

unsigned long

uint32

uint64

64 位的無符號整數。

不符合 cls。

uint64

無內建型別。

ulong

unsigned __int64

uint64 浮點

single

單精度(32 位)浮點數字。

single

float

float

float

double

雙精度(64 位)浮點數字。

double

double

double

double 邏輯

boolean

布林值(真或假)。

boolean

bool

bool

bool 其他

char

unicode(16 位)字元。

char

char

wchar_t

char

decimal

96 位十進位制值。

decimal

decimal

decimal

decimal

intptr

大小取決於基礎平台(32 位平台上為 32 位值,64 位平台上為 64 位值)的有符號整數。

intptr

無內建型別。

intptr

無內建型別。

intptr

無內建型別。

intptr

uintptr

大小取決於基礎平台的無符號整數(32 位平台上為 32 位值,64 位平台上為 64 位值)。

不符合 cls。

uintptr

無內建型別。

uintptr

無內建型別。

uintptr

無內建型別。

uintptr

類物件

object

物件層次結構的根。

object

object

object*

object

string

unicode 字元的不變的定長串。

string

string

string*

string

DLL型別及呼叫

dll 型別判斷 1.mfc 規則dll 沒有介面要求 入口2.mfc 擴充套件dll 有介面匯出 dllmain 入口 3.win32dllapientry dllmain 入口dll分類 1。non mfc dll 非mfc動態庫 不採用mfc類庫結構,其匯出函式為標準的c介面,能被非mfc或m...

C 專案呼叫託管型別的dll

比如在c 專案中,使用c 類庫專案型別生成dll檔案,或使用其他人寫好的託管型別的dll檔案。步驟如下 滑鼠右鍵當前專案下的引用 新增引用 瀏覽 選擇要引用的dll檔案即可。檢查方法 2.1 檢查dll的.net版本 使用vs自帶的一款反編譯工具ildasm.exe,開啟dll檔案,雙擊 manif...

Swift與C型別對應關係表

每乙個 c 語言基本型別,swift 都提供了與之對應的型別。在 swift 中呼叫 c 方法的時候,會用到這些型別 c 型別 swift 對應型別 別名bool cbool bool char,unsigned char cchar,cunsignedchar int8,uint8 short,u...