Differences Between Calling a VI with an Invoke Node and Calling a VI with a Call by Reference Node

Updated May 15, 2018

Reported In

Software

  • LabVIEW Full
  • LabVIEW Base
  • LabVIEW Professional

Issue Details

What is the difference between calling a VI with an Invoke Node and calling a VI with a Call by Reference Node?

Solution

The major difference between calling by reference using an Invoke Node and the Call by Reference Node is the ease of programming versus the flexibility of the architecture. When you use a Call by Reference Node you must wire in a strictly typed VI reference. A strictly typed VI reference includes the connector pane information with data types as well as the reference to the VI. When using the Call by Reference Node, LabVIEW creates a connector pane for you underneath the node. With the Call by Reference node, you are able to take advantage of loading a VI dynamically, while having the convenience of simple wiring.
 

 
When you use an Invoke Node, you are not required to use a strictly typed reference. As a result, you can pass any VI to an Invoke Node to run it.  Using the Invoke Node allows for more flexibility,as it allows you to call VIs that do not have the same connector pane. This is a simple way to only open the Front Panel and run a VI. However, if you want to pass values, you will need to know the names of the Controls and their data types, which requires additional programming. The Invoke Node method becomes more flexible because you can pass any VI path into this setup and it will be able to open and load that VI.

Another benefit of using the Invoke Node to call a VI by reference is the ability to interact with the VI. The Invoke Node method allows you to interact with the VI if it needs to be controlled or if the outputs need to be read multiple times. Using the Call by Reference Node, the connector pane will output values when the VI finishes execution, but it does not provide the capability to interact with a running VI.

 

Additional Information

If you want to call asynchronously the target VI, use the Start Asynchronous Call Node instead of the Call by Reference Node. This will allow the target VI to run on a separate thread.

Using the Invoke Node method may have the target VI run in the UI thread, which can lead to some issues if you want to have the calling VI perform adequately while the called VI is running. This happens even if you have a False constant wired to the Wait Until Done terminal. For a complete asynchronous call in a separate thread, you need to use the modify the target VI's execution by going to File»VI Properties, selecting Execution in the dialog box and selecting an execution system different than user interface or same as caller.

WAS THIS ARTICLE HELPFUL?

Not Helpful