How to Configure LabVIEW to Use Relative Paths for DLLs?

Updated Jan 10, 2019

Reported In

Software

  • LabVIEW

Issue Details

My Packed Project Library (PLL) has a dependency on Dynamic Link Libraries (DLL files). When I build a project using the Build Specifications for PPLs, LabVIEW cannot locate the DLLs to use.  It seems the Call Library Function node changes the name of the DLL to the absolute path of the DLL every time I modify my VI.  


How can I configure LabVIEW to allow the reference by name without changing it to an absolute path?
 

Solution

There is a way to configure LabVIEW to use a reference by name of your custom DLLs.  You can configure the Call Library Function Node to use relative paths by adding the Application Directory VI to your block diagram.  Here is how it works:
  1. Add the Call Library Function Node to the block diagram and double-click it to open the configuration dialog.
  2. Check the Specify path on diagram option.
3.  From the File I/O palette, navigate to the File Constants and then add the Application Directory VI to the block diagram.
4.  Add the Build Path VI and then right-click the lower terminal and select Create > Constant.  In the string constant enter the name of the DLL file.  Your VI should look like this example for the CLF Example.dll


This will ensure you code uses relative paths to call DLLs inside your project.  In this example, the CLF_Example.dll is in the same directory of this VI.  You can construct different paths using Build Path or Strip Path VIs.

Additional Information

LabVIEW always constructs the path to a DLL file internally to find the DLL file every time it needs to call a function that belongs to it.  When you configure the Call Library Function node LabVIEW will prompt you to enter the path of the DLL you wish to call.  It seems that the paths are both absolute and hardcoded in the VI whenever you use a DLL file located in your PC, as LabVIEW will try to look for this DLL if you move the project to another computer.
 

WAS THIS ARTICLE HELPFUL?

Not Helpful