LabVIEW Executable Cannot Find DLL

Updated Nov 3, 2023

Reported In

Software

  • LabVIEW Application Builder Module

Issue Details

  • I have created a LabVIEW executable that works well in my development computer, but produces an error on the deployment computer because a DLL cannot be found. How do I add this library to the executable?
  • I have included a DLL as a dependency in my build, but my deployed executable still cannot find the DLL. I can see that the DLL is being installed on the deployment machine, but it is not being loaded properly.
  • I am running a LabVIEW application on a deployment computer and get the following error: "Missing external function dll..."

Solution

  1. Make sure your DLL is being included in the executable's build. If your code is making a dynamic call to the DLL, then you will need to manage the project's dependencies by adding the DLL to the project manually.
  2. Use a relative path to call the DLL. Include the DLL at a location that can be addressed relative to a known location, such as the directory of the deployed executable. You can then build a relative path in LabVIEW and this path will be valid on the deployment machine as long as the DLL is being installed in the same relative location.​​​​​​
  3. Make sure that the DLL is not included in your user.lib library. The user.lib library does not always fall within the search path; putting your DLL in another folder will allow it to be found.
  4. If the DLL is part of a 3rd party driver make sure you follow the instructions to install it in the deployment computer. Some 3rd party drivers that use external functions from DLLs require other dependencies in order to work correctly. The instructions might include actions such as copying files to a specific folder, adding a path to the environment variables, etc. You can automate these actions by including third-party installers and drivers in a LabVIEW installer .
    1.  If you are not sure about which other dependencies your DLL needs to operate correctly, you can analyze it by using the 3rd party application called Dependencies. With this program, you will be able to explore the DLL and see the required files you need to install. 
  5. Make sure DLL Path Names are not changing between Development and Target Environments.
    1. If so, on the Development Computer, go to Build Specifications>>SVE Channel Builder - DC.
    2. Select Additional Exclusions.
    3. Disable Exclude Dependent Shared Libraries.
    4. This will include the DLLs in the "Always Include" Folder.

Additional Information

  • DLL linking to project builds can be difficult to debug. This article addresses issues stemming from incorrectly sourcing the DLL in LabVIEW code. However, there are many other possible DLL-related issues. See the Related Links section of this article if you have tried the steps here and are still experiencing a DLL-related error.
  • Dynamically-called DLLs are not immediately added as dependencies to a build specifications for the project that includes the dynamic call. They must be added manually.
  • Absolute paths are problematic when moving code between machines since they are often specific to the development machine. The path to the file must be the same on both machines for absolute paths to work effectively. Since this is nearly impossible in most applications, relative paths are recommended.