首页 > 编程语言 > 详细

C与C++之数据类型(一)

时间:2019-12-27 21:15:16      阅读:89      评论:0      收藏:0      [点我收藏+]

阿里P7移动互联网架构师进阶视频(每日更新中)免费学习请点击:https://space.bilibili.com/474380680

C++与C#数据类型总结

 
技术分享图片技术分享图片?
 

C#调用C++的DLL搜集整理的所有数据类型转换方式,可能会有重复或者多种方案。

 
技术分享图片技术分享图片?
 

 

 
技术分享图片技术分享图片?
 

 

 

 
技术分享图片技术分享图片?
 

 

 

 
技术分享图片技术分享图片?
 

 

 

 
技术分享图片技术分享图片?
 

 

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);
技术分享图片

原文链接:https://blog.csdn.net/humanking7/article/details/50981922
阿里P7移动互联网架构师进阶视频(每日更新中)免费学习请点击:https://space.bilibili.com/474380680

C与C++之数据类型(一)

原文:https://www.cnblogs.com/Android-Alvin/p/12109556.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!