By default, a VI contains two kinds of code: the graphical G code that you edit and a compiled version of this code that LabVIEW uses to run the VI. When you edit the G code of the VI, LabVIEW automatically recompiles the VI to reflect your changes in the compiled version of the code. LabVIEW also automatically recompiles all VIs that call the changed VI, which introduces unsaved changes to the calling VIs. Because these unsaved changes complicate source control for VIs, LabVIEW allows you to separate compiled code from VIs.
Determining Whether to Separate Compiled Code from VIs
Separate compiled code from VIs for the following reasons:
- To simplify source control—If you separate compiled code from the VIs within a VI hierarchy, changes to one VI do not produce unsaved changes elsewhere in the VI hierarchy. This behavior allows you to check out only the VI you want to modify.
- To prepare VIs in source control to be upgraded to a new version of LabVIEW—If you separate compiled code from VIs, you do not have to check out the VIs from source control to upgrade them to a new version of LabVIEW.
Do not separate compiled code from VIs you intend to load or run using the LabVIEW Run-Time Engine
Refer to the Caveats and Recommendations for Separating Compiled Code from VIs
for more information about when this option is appropriate for your VIs.
Selecting Which VIs Have Separate Compiled Code
LabVIEW can separate compiled code from the following sets of VIs:
- All new VIs
- To select this option, place a checkmark in the Separate compiled code from source file for new VIs checkbox on the Environment page of the Options dialog box.
||Note You can override this option for individual VIs or VIs in a project by deselecting any of the following options.
- All new VIs in a single project
- To select this option, place a checkmark in the Separate Compiled Code From Source File checkbox on the Project page of the Project Properties dialog box.
||Note This option does not apply to existing VIs that you add to the project.
- All existing VIs in a single project
- A single VI
- To select this option, place a checkmark in the Separate compiled code from source file checkbox on the General page of the VI Properties dialog box. You also can use the Contains Compiled Code property to separate compiled code from a single VI programmatically.
VI Object Files
When you separate compiled code from a VI, LabVIEW maintains the following two files for the VI:
- VI source file (.vi)—Contains the G code of the VI. This is the file you edit.
- VI object file—Contains the compiled code of the VI. You cannot directly access or edit this file.
The VI object file also indicates the LabVIEW version and operating system in which the associated VI was created.
LabVIEW stores the VI object file in the compiled object cache. LabVIEW updates the VI object file only when you save or reload the VI source file, not when you edit it.
||Note A VI without a front panel or block diagram is not the same as a VI object file. You do not need to access a VI object file directly.