LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call dll function using call library node, cluster vs array what is better to preallocate memory

I have dll written in c++. One of the functions that i want to call take input parameter, that is defined as:

 

struct myStruct

{

 uint32_t par1;

 uint32_t par2;

}

It is important that function gets par1 at the first and then it gets par2

My question is:

Since cluster does not have indexes of elements, is it better to pass input to call library node of this parameter "myStruct" as array with tho uint32 elements? Is it wrong to pass it Cluster with two uint32 elements?

0 Kudos
Message 1 of 2
(1,988 Views)

It depends on the function. I assume your function looks something like:

 

int32 myFunc(..., myStruct *param, ...);

Please note the asterix for the param. In that case it is terms of memory allocations equivalent to create a cluster in LabVIEW (with the tab order in the cluster set to the order you want) and configuring the Call Library Node Parameter to Adapt to Type (rest of the configuration has no influence for clusters) or create an array of two elements and configure the parameter to Array of 32 bit integers, Passed as Pointer to Array. The first is however more logical as Clusters are the LabVIEW equivalent of structs.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(1,962 Views)