【DLL动态链接库】labview调用DLL动态链接库参数是结构体数组/字符串数组
labview调用动态库的时候,解析动态中的传递的指针,包括结构体数组,由字符串组成的数组。
动态库内容
#pragma pack(1)//结构体对齐方式,和后面labview中的跳转距离有关
struct MyStruct
{
int a;
double b;
const char *c;
};
#pragma pack(pop)
struct MyStruct ReturningAValue_ComplexStruct(void)
{
int i;
struct MyStruct triangle;
triangle.a = 3;
triangle.b = 0.14;
triangle.c = "dasdfgfg";
return triangle;
}
__declspec(dllexport) void getValue(MyStruct**arr, int length) {
int i;
for (i = 0; i < length; i++)
{
(*arr)[i] = ReturningAValue_ComplexStruct();
}
}
以上用到的子VI在以下文件中,可以在官网下载