background image

----    c#:System.UInt32          

//c++:unsigned __int64, UINT64, DWORDLONG, ULONGLONG 
----    c#:System.UInt64          

//c++:float, FLOAT 

----    c#:System.Single          

//c++:double, long double, DOUBLE 
----    c#:System.Double          

//Win32 Types        ----  CLR Type                  

//Struct 需要在 C#里重新定义一个 Struct        
//CallBack 回调函数需要封装在一个委托里,delegate static extern int FunCallBack(string 

str);        
//unsigned char** ppImage 替换成 IntPtr ppImage        

//int& nWidth 替换成 ref int nWidth        
//int*, int&, 

 

则都可用

ref int 

        

对应

//

 

双针指类型参数,可以用

ref IntPtr        

//函数指针使用 c++: typedef double (*fun_type1)(double); 

 

对应

c#:public delegate 

double  fun_type1(double);        
//char* 的操作 c++: char*; 

 

对应

c#:StringBuilder;        

//c#中使用指针:

   

在需要使用指针的地方 加

unsafe        

//unsigned   char 对应 public   byte        
/*         

* typedef void (*CALLBACKFUN1W)(wchar_t*, void* pArg);         
* typedef void (*CALLBACKFUN1A)(char*, void* pArg);         

* bool BIOPRINT_SENSOR_API dllFun1(CALLBACKFUN1 pCallbackFun1, void* pArg); 

         

调用方式为

* [UnmanagedFunctionPointer(CallingConvention.Cdecl)]         
* public delegate void CallbackFunc1([MarshalAs(UnmanagedType.LPWStr)] 

StringBuilder strName, IntPtr pArg);         
*          

*          
*/