Rules for Using DLL Files
- Updated2023-02-21
- 2 minute(s) read
Your executable or DLL can link to a DLL only through an import library. This section refers to a DLL that an executable or another DLL uses as a subsidiary DLL. You can link an import library into your program in any of the following ways:
- List the DLL import library in your project
- Associate the DLL import library with the .fp file for an instrument driver or user library
- Dynamically load the DLL import library by calling the Windows SDK function LoadLibrary
If you list a DLL import library in the project or associate it with an instrument driver or user library, LabWindows/CVI statically links the import library into your executable or DLL. However, if you load the import library through a call to LoadLibrary, you must distribute it separately from your executable.
Regardless of the method you use to link the import library, you must distribute the subsidiary DLL separately. The import library always contains the name of the subsidiary DLL. When your executable or DLL is loaded, the operating system finds the subsidiary DLL using the standard DLL search algorithm. For information about the DLL search algorithm, refer to the help for LoadLibrary on www.msdn.com. The search precedence is as follows:
- The directory from which the user loads the application
- The current working directory
- The Windows system directory
- The Windows directory
- The directories listed in the PATH environment variable
When you create a new distribution, LabWindows/CVI automatically adds the DLLs to which your project refers to the Installation Files & Directories browser in the Edit Installer dialog box Files tab. You must build your project for LabWindows/CVI to automatically add these dependent files to the installer. You must use the Files tab to add to the installer any DLLs that you load by calling the Windows SDK function LoadLibrary.
Do not use the Edit Installer dialog box Files tab to include DLLs for National Instruments hardware in your installer. Instead, select the necessary hardware components in the Edit Installer dialog box Drivers & Components tab.