Dynamically Called SubVI Does Not Load When Built Into an Executable

Updated Sep 21, 2023

Reported In

Software

  • LabVIEW
  • LabVIEW Run-Time Engine

Issue Details

I have an application that dynamically calls a subVI. This subVI is not part of my LabVIEW project. This works as expected when I am running the code in the development environment. However, I see the following issues when I run my executable on the deployment computer: 
  • When I build my project into an executable, the subVI does not load completely
  • LabVIEW Run-Time Engine shows Error 1003: The VI is not executable. This error may occur because the VI is either broken or contains a subVI that LabVIEW cannot locate.
  • When I call a VI that contains an Xcontrol dynamically, the Xcontrol shows a broken control icon as in the image below:
broken xcontrol.png
 

Solution

Your dynamically called VI not loading is a result of a linking issue between this VI and its dependencies. Since the dynamically called VI is not part of the executable, when it is called its dependencies (subVIs) try to point back to vi.lib in the development environment. The dynamically called VI does not know where to look in the execution namespace for its dependencies. Try the following steps to resolve this issue:
  1. Build all of your dynamically called subVIs and their dependencies into a Packed Project Library (PPL).
    1. Include all of the subVIs called by your dynamically called VI in your LabVIEW project
    2. Right click on My Computer >> New >> Library
      1. Add all of the subVIs that are dynamically called VI uses to the library you just created. This can be done by selecting the subVIs and the dependencies and then dragging and dropping them under the newly created library.
    3. Build the subVIs into a PPL by right-clicking on Build Specifications >> New >> Packed Library
      1. Under the Source Files category, set the library that you have previously created as the Top-level Library. This can be done by selecting the .lvlib file in the "Project Files" section and then clicking on the right arrow to add it as the top-level library: source files.png
      2. Build the PPL by clicking on Build.
  2. Make sure that the specified path used by the Open VI Reference Function is set correctly according to the internal PPL structure. You can use the Get Exported File List VI to get the paths of the exported files in a packed project library if you are not sure about the path structure.
  3. If the dynamically called subVI uses any controls, set the access scope of the controls to Public. 
  4. Build an executable by right-clicking on Build Specifications >> New >> Application (EXE)
    1. Under the Source Files category, add your PPL to be Always Included.

Additional Information

Another workaround if you want to include the subVIs' dependencies into the LabVIEW project to be able to call them dynamically is to add them and their dependencies to the main VI similarly as described in the following article: Missing SubVI Broken Run In Executable Dynamic Calling Mean SubVI in LabVIEW