【发布时间】:2014-06-04 03:08:45
【问题描述】:
请告诉我区别
int* variable
int * variable
int *variable
void* variable
void** variable
char*
short variable //(C++) in c# this type more suitable with? short type too??
我有 .h、.lib 和 .dll 文件,但我不知道 lib 和 dll 文件的内容
例子:
这个来自头文件
#ifdef cpp_EXPORTS
#define cpp_API __declspec(dllexport)
#else
#define cpp_API __declspec(dllimport)
#endif
extern "C"
{
cpp_API char* cpp_Version(void); // What should i use better for(void) and what is the meaning char*
cpp_API int cpp_AddUser(void* User, double Acc, double Limit, int* NewId); //example for void* variable and int* variable
cpp_API int cpp_AddModifyBilling(int Act, int Level, wchar_t* BillingCo, wchar_t* Desc, int * BillingId); //example for int * variable
cpp_API int cpp_DeleteBilling(int Act, wchar_t* Code1, wchar_t* Code2, wchar_t* Code3, int Billable, int *CombId); //example for int *variable
cpp_API int cpp_GetUser(int UserId, void** UserInfo); //example for void** variable
...
}
#pragma pack(1) //and is the meaning about this one ??
问题:
1. *(符号)是否用在其他具有相同含义的数据类型中,类型和变量之间的位置是什么意思?
2. 如果我想编组为 C# 数据类型,哪些数据类型更适合编组的数据类型?
任何建议和答案都会非常有帮助
谢谢
【问题讨论】:
-
你需要了解什么是 C++ 中的指针(* 用于声明指针)
-
哦,符号的名字是指针,我明白了,但是双指针(**)呢?这有相同的含义吗?我可以在c#中使用指针吗??
标签: c# c++ marshalling