|| 3.33 out of 5
Passing an Array of Clusters From LabVIEW to a DLL
Primary Software Version:
Primary Software Fixed Version:
Is it possible to pass an array of clusters from LabVIEW to a DLL?
Yes, this is possible. Passing an array of clusters from LabVIEW to a DLL can be accomplished by using a Call Library Function Node.
- Place a Call Library Function Node on the block diagram (found in the Connectivity » Libraries & Executables palette).
- Right click the node and select Configure....
- After selecting the DLL and function to call from the Function tab, select the Parameters tab.
- Click the + button to create a new argument for the call.
- Name the argument and select Adapt to Type from the Type pulldown menu.
- Select Array Data Pointer from the Data format pulldown menu.
There are a few extra considerations you must account for in the DLL when you call it in this manner. LabVIEW will pass a pointer to the first cluster in the array to the argument you specify. LabVIEW does not pass any information regarding the length of the array
. Because of this, you may want to create a second argument to pass the array size. Furthermore, the layout in memory of the fields in the cluster may not be what you expect. In order to see how LabVIEW will lay the fields out in memory, you can use a Code Interface Node.
Related Links: LabVIEW 8.6 Help: Configuring the Call Library Function NodeKnowledgeBase 3HGBK7QG: My Call Library Function Node Cannot Output Arrays, Waveforms, or Tables
- Place a Code Interface Node on the block diagram (found in the Connectivity » Libraries & Executables palette).
- Wire your cluster to the input of the node.
- Right click the node and select Create .c File....
- Save and open the resulting C file. Notice that the struct LabVIEW generates here will be the same struct that is passed to the Call Library Function Node.