一、C#调用C++的DLL搜集整理并测试通过的数据类型转换方式,可能不太全,大家可以多测试。
C++ |
C# |
Int32_t |
Int/Intptr |
Int32_t & |
ref InPtr /out Inptr |
const char* |
string |
bool |
Boolean |
结构体* 结构体变量1 |
ref 结构体 结构体变量2 |
char 数组 |
string |
uint32_t |
uint |
回调函数 |
委托 |
Void * |
Intptr |
int |
int |
结构体 变量1 |
结构体 变量2 |
结构体 ** 变量1 |
Ref 结构体 变量2 |
Int * |
Ref int |
const 结构体 * result |
IntPtr |
C++ |
C# |
Int32_t |
Int/Intptr |
Int32_t & |
ref InPtr /out Inptr |
const char* |
string |
bool |
Boolean |
结构体* 结构体变量1 |
ref 结构体 结构体变量2 |
char 数组 |
string |
uint32_t |
uint |
回调函数 |
委托 |
Void * |
Intptr |
int |
int |
结构体 变量1 |
结构体 变量2 |
结构体 ** 变量1 |
Ref 结构体 变量2 |
Int * |
Ref int |
const 结构体 * result |