LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Static VI reference

When do people actually use the static VI reference?  It seems to me that it is only useful if you want to hardcode a vi reference with its location into the code.  I can only use it with the call by reference node.  Is the static VI reference useful elsewhere?  I know how to use it with the call by referene node when it is stictly typed, but when it is not strictly type, I don't know when to use it.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 4
(3,335 Views)

I use it for two additional things:

 

  1. If I want to place a free running subVI into a subpanel or otherwise control it programmatically.
  2. If I want to generate reentrant copies of a VI. The static reference ensure that the VI is in memory (included in the build) and you can then use its name or path property to open the new reference.

___________________
Try to take over the world!
Message 2 of 4
(3,313 Views)

@tst wrote:

I use it for two additional things:

 

  1. If I want to place a free running subVI into a subpanel or otherwise control it programmatically.
  2. If I want to generate reentrant copies of a VI. The static reference ensure that the VI is in memory (included in the build) and you can then use its name or path property to open the new reference.

Number 2 for me as well.  This makes reentrant calls to dynamically called VIs work nicely in EXEs as well.  If I just reference a VI by name I need to be sure that that VI is in memory.  This use to mean include it in the build in an EXE, and then build the path to it (my.exe\reentrant.vi) and call it.  But this means I need to remember to add this to a build ever time I use this VI that calls the reentrant VI.  With the static reference, the calling VI knows that the reentrant VI is needed and a dependency so it will be included by the application builder.  Then when I need to call it I can get the name from the static reference it self, so again I don't even need to know the name of the VI.

Message 3 of 4
(3,301 Views)

I "inherited" some LabVIEW 7 code that programmatically started and stopped VIs using VI Server calls.  All of them used Open VI Reference, wiring a string or path constant into the function.  This project had well over 1000 VIs, and there was absolutely no documention anywhere (including a description of what the VI was supposed to do).

 

I found a lot of "orphan" VIs that I assumed weren't being used as they didn't seemed to be called by any other VI.  Oops, their calls were "hidden" -- their names were being used, so I had to do a string search to find them.  Grrr.

 

Replacing all of these strings with Static VI References really helped bring this situation under control.  Now, during development when most of the VIs are in memory, I can simply open a VI in question and ask for All Instances, knowing it will find the Static VI Reference.  A plus is if the VI has a "nice" icon (with at least a name string), it is visually pretty mnemonic what is being called.

Message 4 of 4
(3,175 Views)