Why do I need to separate compiled code from the VI file?

Selecting the setting “Separate compiled code from new files” in the Environment section of the LabVIEW Options is useful when you are using source code control during code development.  To understand why, we first need to understand the information that is stored in a LabVIEW file for a virtual instrument (*.vi).  A LabVIEW virtual instrument file contains the following six primary items:

  • Front Panel – The graphical representation of controls and indicators that make up the User Interface.
  • Block Diagram – The graphical representation of the G code that describes how the VI will work.
  • Connector Pane – Connections that allow one to pass data into and out of the VI.
  • Icon – The unique image that identifies the VI when used on another block diagram.
  • Compiled Code – The machine language code resulting from compiling the block diagram.
  • Implaceness Info – Sometimes also called the Data Space for the VI, this is the memory that is used to store values of the controls and indicators of the VI along with values of data on wires and in shift registers as the VI executes.  

Now, suppose we have a situation where we have a Main.vi that calls two subVIs A.vi and B.vi, the latter of which also calls subVI C.vi as shown in the adjacent VI hierarchy.  If we make a small change to subVI C then both subVI B and the Main VI will have to be recompiled because they depend upon C.  If the compiled code and the data space are stored in the VI file then this will result in Main.viB.vi and C.vi all being marked as changed by the versioning system when only a change was made to C.vi.

However, when we select the option “Separate compiled code from new files” the file format that is actually saved to disk only contains the Front Panel, Block Diagram, Connector Pane, and Icon.  When these files are loaded into memory, the compiled code and data space are allocated space in computer memory but not stored on disk.  This makes maintaining the code repository simpler as the only files that will need to be committed to the repository are the ones that contain actual changes.

As a reminder, the following instructions will help you set up LabVIEW to keep the compiled code separate from the VI file.

In LabVIEW, under Tools>Options>Environment be sure to check the option entitled “Separate compiled code from new files”. The purpose here is that if file A depends upon file B (i.e. B.vi is a subVI called by A.vi) and if you edit file B then this setting will allow you to only have to commit the changes you made in B.vi to the repository and not also have to commit A.vi. This can also be done for all existing files in a project by using the Properties dialog in the Project Explorer.

 

Print Friendly, PDF & Email