C and C ++ data types of (a)

Ali P7 mobile Internet architect, Advanced Video (Daily update) for free learning, please click: https://space.bilibili.com/474380680

C ++ and C # data types summary

 
19956127-85f31f50356d5085.png
 

C ++ C # to call the DLL has collected all the data type conversions way, there may be a repeat or a variety of programs.

 
19956127-1fd69f5759922266.png
 

 

 
19956127-45506e0dfb7ddfc4.png
 

 

 

 
19956127-cd3f8e1ce75f9c44.png
 

 

 

 
19956127-8d5dfe119e0c72fe.png
 

 

 

 
19956127-25fe834ae5f05250.png
 

 

Win32 Types —- CLR Type

Struct need to be defined in C # in a Struct
the CallBack callback function needs to be encapsulated in a delegate Lane, delegate static extern int FunCallBack (string str);
alternatively unsigned char ppImage ** to IntPtr ppImage
int & nWidth replaced REF int nWidth
int , int &, then available ref int the corresponding
needle refers to the type parameter can ref IntPtr
function pointers using C ++: typedef Double (
fun_type1) (Double); corresponding to c #: public the delegate Double fun_type1 (Double);
char * operating c ++: char * corresponding to c # : the StringBuilder
c # pointers in use: add in place need to use unsafe pointers

corresponding to public byte unsigned char

 typedef void (*CALLBACKFUN1W)(wchar_t*, void* pArg);
 typedef void (*CALLBACKFUN1A)(char*, void* pArg);
 bool BIOPRINT_SENSOR_API dllFun1(CALLBACKFUN1 pCallbackFun1, void* pArg);

Called to

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void CallbackFunc1([MarshalAs(UnmanagedType.LPWStr)] StringBuilder strName, IntPtr pArg);

Original link: https://blog.csdn.net/humanking7/article/details/50981922
Ali P7 mobile Internet architect, Advanced Video (Daily update) for free learning, please click: https://space.bilibili.com/ 474 380 680

Guess you like

Origin www.cnblogs.com/Android-Alvin/p/12109556.html