Open VI Reference Function
- Updated2025-01-28
- 11 minute(s) read
Open VI Reference Function
Returns a reference to a VI, custom control, or global variable specified by a path to the file on disk, name string, or existing reference.

Inputs/Outputs
![]() type specifier VI Refnum (for type only) determines the connector pane information and data type of vi reference. LabVIEW ignores the actual value of this input. By default, the function returns a Generic VI reference. If you want to use the vi reference output of this function with the Call By Reference node or the Start Asynchronous Call node, you must wire a strictly typed VI reference to this input. If you wire a strictly typed VI reference to this input, the connector pane of the VI specified by vi path must match the connector pane of this input. ![]() application reference is a reference to a LabVIEW application instance. By default, LabVIEW uses the application instance of the calling VI. You can obtain references to other application instances with the Open Application Reference function. If you wire a reference to another application instance to the application reference input, vi path refers to a location in the file system of the computer that is running that application instance.![]() vi path accepts a path to the VI that you want to reference, a string containing the name of the VI that you want to reference, or a VI reference to the VI that you want to reference. If you wire a path, LabVIEW searches for a VI in memory that you previously loaded from that path on the same target. If you wire a name string, the string must match the full delimited name of a VI in memory on that target. If a matching VI is not found in memory, LabVIEW then tries to load the VI from that file on disk. An error occurs if LabVIEW cannot find the file. If the path is relative, the VI interprets the path as relative to the caller VI or to the application directory, if the caller VI is not saved. Note
If you specify a remote application instance with application reference, the path is interpreted on the remote machine in the context of the remote file system. The path is expressed using the local computer's path separators, but is translated to the remote computer's path separators when the request arrives there. For example, to reference a VI on Linux at My HD/LabVIEW Vis/foo.vi from a Windows–based application, use the path My HD:\LabVIEW Vis\foo.vi. Conversely, to reference a VI on a computer running Windows at C:\labview\foo.vi from an Linux application, wire the path C/labview/foo.vi. If you wire a path or you wire both VI and application references, LabVIEW waits until the user interface is idle to load the VI from disk. If you wire a name string or a VI reference without an application reference, LabVIEW does not need to wait until the user interface is idle, as it does not load a VI from disk. LabVIEW will only search in memory for a VI with a specified name. Note LabVIEW does not support the ability to open a reference to a clone VI using a name with the Open VI Reference function. Using this function to open a reference to a clone VI may cause LabVIEW to crash.
![]() options determines characteristics of the VI referenced by vi reference, including whether you can call the VI asynchronously. The default is 0x0. Create options by combining a subset of the following option flags.
![]() error in describes error conditions that occur before this node runs. This input provides standard error in functionality. ![]() password is the password for the VI whose reference you want to open. Wire a password to this input if you want to edit a password-protected target VI. If you wire the correct password, the function returns an authenticated reference to the VI. If you wire an incorrect password to this input, the function returns an error and an invalid VI reference. LabVIEW ignores this input if the target VI is not password-protected. If you do not wire a password to this input and the target VI is password-protected, the Open VI Reference function returns a valid reference, but you cannot use the reference to edit the VI.Note You can also use a VI Server Reference to get an authenticated reference to a VI.
![]() vi reference is the refnum associated with the requested VI. If the function fails, vi reference contains Not A Refnum.![]() error out contains error information. This output provides standard error out functionality. |
The Open VI Reference function prepares a VI reference for dynamic calls by the Call By Reference node, the Start Asynchronous Call node, and the Wait On Asynchronous Call node. Use the type specifier VI Refnum (for type only) and the options inputs to prepare a reference for dynamic execution.
Opening References for Dynamic VI Calls
If you want to call the specified VI dynamically with the Call By Reference Node or the Start Asynchronous Call Node, you must use appropriate data for the following parameters:
- type specifier VI Refnum (for type only)—Wire a strictly typed VI reference to this input.
- options—Determine whether the 0x08, 0x40, 0x80, and 0x100 option flags apply to the way you want to call the referenced VI.
Criteria for Opening Strictly Typed References
If you wire a strictly typed VI reference to the type specifier VI Refnum (for type only), the VI specified by vi path must meet the following criteria:
- The VI cannot be broken.
- The VI cannot be active as a top-level VI unless the VI is reentrant.
- The connector pane of the VI must match the connector pane of type specifier VI Refnum (for type only).
Opening References to Reentrant VIs
If you open a reference to a reentrant VI, consider the following details:
- Dynamic calls to reentrant target VIs execute serially unless you specify 0x40 as one of the options.
- If you use the 0x40 option flag to execute instances of a reentrant target VI in parallel, vi reference refers to the target VI rather than to a clone of the target VI. However, both the Call By Reference node and the Start Asynchronous Call node call a clone of the target VI. Therefore, if you call a VI Server property or method on vi reference, the property or method does not affect the clone VIs that those nodes actually call.
- The Equal? function always returns TRUE when you compare two references to the same reentrant VI. To determine whether the references refer to the same instance of the reentrant VI, use the Type Cast function to convert the references to 32-bit signed integers. Then use the Equal? Function to compare those integers.
Aborting Open References
You can abort all open VI references either manually from the front panel of the VI or by using the Abort VI method. However, VI references prepared for asynchronous execution have important caveats depending on the options used to open the reference:
- 0x80—A call-and-forget VI aborts only if you manually abort it from its front panel or call the Abort VI method on it. Otherwise, the VI runs to completion, even if you close the reference or abort the calling VI.
- 0x100—Call-and-collect VIs abort for the following reasons:
- You abort the VI that opened the call-and-collect VI reference. In this case, LabVIEW aborts all running instances of the VI.
- You manually abort a specific instance of the VI. In this case, exactly one Wait On Asynchronous Call node returns an error indicating that the called VI aborted. All other Wait On Asynchronous Call nodes that are waiting on calls to the same VI reference continue waiting.
- You call the Abort VI method on the call-and-collect VI reference. In this case, LabVIEW aborts all currently running instances of the VI. A corresponding number of Wait On Asynchronous Call nodes return errors.
Closing Open References
After you finish using a reference that you obtain with this function, close the reference with the Close Reference function. Explicitly closing a reference enables LabVIEW to free the resources involved in maintaining that reference, thereby contributing to optimal memory allocation and performance. Otherwise, LabVIEW cannot close the reference until the VI that opened the reference finishes executing.
Opening a VI Reference in a Stand-Alone Application
If you want to dynamically open a VI on both the development computer and within a stand-alone application, use a relative path for vi path.
Miscellaneous Details
- If you set the Execution:Run When Opened, Execution:Show Front Panel On Load, or Execution:Show Front Panel On Call properties or the corresponding options in the VI Properties dialog box of the target VI, LabVIEW ignores the settings.
- To open a new Facade VI reference, wire a FacadeVI class to type specifier VI Refnum (for type only).
Examples
Refer to the following example files included with LabVIEW.
- labview\examples\Application Control\VI Server\Asynchronous Call By Reference\Asynchronous Call and Collect (Using Option 0x40).vi
- labview\examples\Application Control\VI Server\Asynchronous Call By Reference\Asynchronous Call and Forget.vi
- labview\examples\Application Control\VI Server\Asynchronous Call By Reference\Asynchronous Call and Collect.vi