LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Pass structure to Call Library Function Node and change its values inside

 

Hi all.
I've looked at the examples, tried programming some tests, read on the forum... but I don't understand yet how Call Library Fuction Nodes work with complex data types...
Attached you can see the data type I want to pass to a Call Library Function Node. It consists of a cluster with two elements: an integer and an array. The elements of this array are clusters. And each cluster contains two integers and two arrays (one with integers, and the other with doubles).

I want also to be able to modify within the node the data contained in the entry cluster and return it back to LabView (I know it cannot be via return type, but wiring the output related to the data type input). So, I think I should use "Adapt to Type" in the Type selection for the input and use some kind of pointer to the structure to be able to modify it. But I don't know how to manipulate the data in C/C++.
Could you please help me?
Regards,
Francisco
0 Kudos
Message 1 of 2
(2,468 Views)

Is there any chance you know how large your arrays will be?  If so, I recommend replacing them with clusters of the same size.  This will allow you to have a structure that is easily translated to a struct in C.  You can generate a cluster of a specific size by creating a control from the output of Array to Cluster, with the cluster size set appropriately.  As far as C is concerned, an array and a cluster of identical items are the same thing in memory, so even though you have a cluster in LabVIEW your C code can treat it as a fixed-size array.

0 Kudos
Message 2 of 2
(2,458 Views)