This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Quickly Calling VIs Dynamically in LabVIEW

Updated Oct 23, 2020

Environment

Software

  • LabVIEW

I want to be able to dynamically load a subVI into memory from my top-level VI, but is there a quicker, easier way to do this without using Open VI Reference, specifying a strictly typed VI refnum, and wiring the reference into a Call by Reference Node?

Yes, there is a quicker and easier way to call VIs dynamically using LabVIEW 8.0 and above. You no longer have to use Open VI Reference for VIs that you want to call dynamically that are located on the same computer as your top-level VI. Follow these steps to call a subVI dynamically from LabVIEW:
  1. Place the subVI on the block diagram of the VI that you want to call it from.
  2. Right click the subVI and select Call Setup from the shortcut menu.
  3. In the resulting dialog, there are three options: Load with CallerReload for Each Call, and Load and Retain on First Call. If you select Load with Caller, the VI is called like any other subVI. It is loaded statically into memory when the VI calling it is loaded into memory. If you select Reload for Each Call or Load and Retain on First Call, then the VI will be called dynamically when the execution of the code reaches that part of the block diagram. The only difference between these two selections is whether the VI is unloaded from memory immediately after finishing its execution or retained in memory until the calling VI itself closes.
After selecting one of the dynamic options, your subVI will change appearance to indicate that it is being called dynamically as shown below:
 

You have direct access to the connector pane for the subVI, and there is no input or output terminal for a VI refnum. This VI call does add error in and error out terminals to indicate respectively whether the VI should be loaded or whether an error occurred while loading the VI.

If you would like to remotely call a VI on another machine, then you will still need to use Open Application Reference to open a reference to an instance of LabVIEW on the remote machine and then Open VI Reference to open a reference to the VI on that remote machine.