LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I store VI References in global variables and access them later

From what I know, Labview automatically deletes VI references when they go out of use. Is there a way for me to override this so that I can access a set of preloaded references in a separate VI? Essentially I would like to open the VI's dynamically into the memory, store the references in global variables and access them at a later time. The VI's I'm referencing won't be known until runtime. I know its not the safest way to do it, but it would be the most productive on my end.

 

Thank you

Clay Upton

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

I'm not sure what you mean by "a later time", but a VI reference will remain valid as long as the VI is in memory. If you don't unload the VIs, the references will remain valid.

 

If you do need to unload the VIs, for whatever reason, I would suggest the following:

  1. Create a functional global as your interface for obtaining the references.
  2. Feed the paths to the VIs into the VI when initializing it (since you don't know which VIs in advance).
  3. When calling the VI to obtain the references, have the VI check them first (using the Not a Number... primitive). If it sees that they're invalid, it can open a new reference and return that.

You should note that when a VI is removed from memory, the data space is used is released, so if those VIs are expected to hold data (using shift registers, etc.) this will be a problem.

 

The description I've given will only be usable in certain instances (and it has its intricacies), but you didn't really give any details about what you're actually trying to accomplish.


___________________
Try to take over the world!
0 Kudos
Message 2 of 2
(2,608 Views)