Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
3 ratings:
 3.33 out of 5   

Passing an Array of Clusters From LabVIEW to a DLL

Primary Software:
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

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.
  1. Place a Call Library Function Node on the block diagram (found in the Connectivity » Libraries & Executables palette).
  2. Right click the node and select Configure....
  3. After selecting the DLL and function to call from the Function tab, select the Parameters tab.
  4. Click the + button to create a new argument for the call.
  5. Name the argument and select Adapt to Type from the Type pulldown menu.
  6. 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.
  1. Place a Code Interface Node on the block diagram (found in the Connectivity » Libraries & Executables palette).
  2. Wire your cluster to the input of the node.
  3. Right click the node and select Create .c File....
  4. 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.

Related Links:
LabVIEW 8.6 Help:  Configuring the Call Library Function Node
KnowledgeBase 3HGBK7QG:  My Call Library Function Node Cannot Output Arrays, Waveforms, or Tables


Report Date: 11/17/2006
Last Updated: 06/10/2009
Document ID: 43GBTHSN

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit