大脚怪 发表于 2006-4-8 18:55:49

大脚怪 发表于 2006-4-8 18:57:56

大脚怪 发表于 2006-4-8 19:01:53

mebusw 发表于 2006-4-10 09:10:35

Re:求教,关于调用DLL中结构+数组的疑问

建议
1.更改CLF中的calling conversion为 "C"
2.pInfo参数的data format由handles by value 更改为pointer to handles

毕竟手头没有卡,只能提供这些供参考

lucky!

大脚怪 发表于 2006-4-10 18:19:07

wanghj0320 发表于 2006-4-11 09:22:23

Re:求教,关于调用DLL中结构+数组的疑问

LV中cluster的定义和C中的struct不太一样。
LV在cluster的开头有4个字节存储cluster中有几个元素。array也带了4字节存储元素。(主要因为LV存储cluster不是连续内存块,所以要记录个数)
LabVIEW stores cluster elements of varying data types according to the cluster order. To set cluster order, right-click the cluster border and select Cluster Order from the shortcut menu. LabVIEW stores scalar data directly in the cluster. LabVIEW stores arrays, strings, and paths indirectly. The LabVIEW cluster stores a handle that points to the location in memory where the data is stored. Because of alignment constraints of certain platforms, a few bytes of padding might follow the dimension size so that the first element of the data is correctly aligned. If you write DLLs or CINs, some platforms have special requirements about how you align and pad memory.
所以最好将cluster用flatten to string转换为binary传入DLL

zhangceusb 发表于 2008-10-26 21:48:46

终于明白了
页: [1]
查看完整版本: 求教,关于调用DLL中结构+数组的疑问