1.pinvoke结构不对称,添加语句(网上有)

2.含回调函数,成员参数的结构体必须完全,尽管自己用不到。

3.加深对c++指针的理解。一般情况下,类型加*等效于c++中的ref。但对于short* 、float*等,根据具体的内容来进行确定类型。

这次例子用到的内容就是地址。c#用IntPtr来代替。

而传参的时候,c#这样声明与运用:

int iImageW = pY16Info.ImgWidth;//图像宽
int iImageH = pY16Info.ImgHeight;//图像高
IntPtr pOpque = pY16Info.pOpque;
int size = Marshal.SizeOf(typeof(float));
IntPtr infosIntptr = Marshal.AllocHGlobal(pY16Info.ImgWidth * pY16Info.ImgHeight * size);
GD_DATAS = new float[pY16Info.ImgWidth * pY16Info.ImgHeight];
if ((int)GD_MTC_ERROR_CODE.NO_ERROR == GD_MTC_SDK_GetTempMatrix(pOpque, infosIntptr))//获取实时全图温度
{
for (int inkIndex = 0; inkIndex < pY16Info.ImgWidth * pY16Info.ImgHeight; inkIndex++)
{
IntPtr ptr = (IntPtr)((UInt32)infosIntptr + inkIndex * size);
GD_DATAS[inkIndex] = (float)Marshal.PtrToStructure(ptr, typeof(float));
}
}
else
{
GD_DATAS = null;
}

4.当遇到棘手问题时候,简便做法就是unsfe来写c#,c++指针参数照搬。但是取地址等其他操作还得用c#自己的。

最新文章

  1. 解决编译apache出现的问题:configure: error: APR not found . Please read the documentation
  2. 一个链式调用 setTimeout的例子
  3. 【LeetCode】16. 3Sum Closest
  4. oracle 10g升级到11g
  5. tp28xx port pin (open-drain )and (push-pull) 和open collector)
  6. 在unity的scene中画五角星
  7. RecyclerView.Adapter
  8. Effective C++笔记之Item49【了解new-handler的行为】
  9. MySQL索引(1)
  10. Visual Studio中Image Watch的使用
  11. Visual Studio 2015 激活码
  12. MERGE INTO 解决大数据量 10w 更新缓慢的问题
  13. git merge以及比较两个repo
  14. vuejs、eggjs、mqtt
  15. 返回最小的k个数
  16. 手工释放linux内存------/proc/sys/vm/drop_cache
  17. 什么是'脑分裂(split brain)'?
  18. 【RF库Collections测试】Dictionary Should Contain Value
  19. Android 4.4 KitKat终于支持录屏(Screen Recording)了!
  20. JavaScript 数组遍历方法的对比

热门文章

  1. Android Studio 2.3.3 出现Error:(26.13) Fail to resole: com.android.support.appcompat永久解决方法
  2. 树莓派3B+学习笔记:10、使用SSH连接树莓派
  3. python 文件读取方法详解
  4. 文件句柄W模式
  5. 20155330 2016-2017-2 《Java程序设计》第二周学习总结
  6. 20155338 2016-2017-2 《JAVA程序设计》课程总结
  7. WPF中。。DataGrid 实现时间控件和下拉框控件
  8. sql语句-3-聚合数据查询
  9. [BZOJ2961]共点圆-[凸包+cdq分治]
  10. hadoop 、hive 的一些使用经验。