Showing results for 
Search instead for 
Did you mean: 

pass object as reference

Hiw can i pass a LV object as a reference?
0 Kudos
Message 1 of 7

What exactly do you mean?

You can create references as seen in the picture...


Remember Cunningham's Law
0 Kudos
Message 2 of 7

Sorry i didn't have a proper question. I have a LV class - Thread. Which has a VI that runs ascyn. LV is baased on data flow, thus most things are pass by values. However i wanted to hold values for the Object created in the VI therefore it has to be pass by reference.


Whats the generic lass for LV object?

0 Kudos
Message 3 of 7

You can use a global variable in that case. Check out the link below.



0 Kudos
Message 4 of 7
Well, global would solve the problem not i won't do it as it defeats the purpose of OO, having data encapsulated. Anyway thanks!
0 Kudos
Message 5 of 7

You can still create references from objects. I was able to do it, in the usual way ( Right click object -> Create -> Reference).


Once you drop the class in block diagram, did you select right - click and  'Change to control' ?



0 Kudos
Message 6 of 7

Search this site for "Singlton".


There are a couple of ways of achieving a Singlton in LV. Early versions used a single element queue to hold the data so that only the thread that has the lock on the queue can access it.


An updated version uses a DVR (Data Value Refence) to hold the instance of the class.


If you are developing an Active Object there is supposedly ( I have not read it yet) an Actor pattern recently included in LV.


I hope that helps,



Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 7