Executable Cannot Find My DLL Even With A Specified Path

Updated Jul 31, 2023

Reported In

Software

  • LabVIEW Base
  • LabVIEW Full
  • LabVIEW Professional

Issue Details

  • I have a VI that calls a DLL with the Call Library Function Node. In the development environment, the DLL is called correctly and the application works as I expect. When I build an executable, I am prompted to find the DLL. How can I prevent the prompt from appearing?
  • I have in my LabVIEW project a file with the DLL files of my instruments. When I build the executable I get the following warning:
LabVIEW prevented a file name collision during the build. Duplicate file names cannot be copied to the same destination. You can rename files as part of the build process to avoid name conflicts.
When I finish building my application I go to the Support Files and the DLL files are not there. How do I fix this?

Solution

Executables only look in certain directories for a DLL. Windows will search the following locations in order for your DLL:
  1. The current directory that the executable is running from
  2. The Windows system directory (<Windows>\System32)
  3. Any paths specified in the PATH environmental variable
By default, LabVIEW will copy most DLLs that are called with the Call Library Function Node into the data directory of the executable.

If the Instruments DLL files are inside folders:
  1. Go to Application Properties >> Destinations 
  2. Create a folder with the same name as the one in the Project in LabVIEW
  3. Go to Source File Settings
  4. Select the folder that contains the DLL and in Destination choose Support Directory
For more information about how to include files in the .exe file please visit: Including Supporting Files in the Same Directory as the .exe File When Building an Executable in the Related Links section

Additional Information

If you are using user32.dll or another WinAPI DLL in your application and you do not properly specify the location of the library on disk, you may receive the following error when attempting to run your executable: Entry Point Not Found: The procedure entry point wcscat_s could not be located in the dynamic link library ntdll.dll. When you build an executable that calls a shared library, LabVIEW includes a local copy of the DLL in the data support directory of the build. When the executable runs, the LabVIEW Run-Time Engine searches for the shared library in this directory first. By doing so, the Run-Time Engine will call the wrong version of the WinAPI DLL on your deployment computer which can cause wide variety of issues. 

If you are calling a WinAPI DLL located in the system directory, you have three options:
  • Enter the DLL file name itself without its path in the Call Library Function Node. This will avoid creating a copy of the DLL in the data directory when building the application.
  • Delete the WinAPI DLL from the data directory. The executable will now search for the DLL every time you launch the executable. Fix this by adding the <Windows>\System32 folder to the VI Search Paths (Tools»Options»Paths»VI Search Path) of the executable.
  • Choose Specify path on diagram from within the dialog box of the Call Library Function Node and hard code the path to the shared library to the path in input on the block diagram.