Linking to DLL Defined Functions from LabWindows™/CVI

Updated Mar 20, 2023

I have an external module or library that I want to call in my code. How do I link and use functions defined in a dynamically linked library (DLL) in LabWindows™/CVI?

The easiest way to make a function call to a DLL in LabWindows/CVI is to use an Import Library. You must include the DLL's import library in your LabWindows/CVI project in order to make the function call. To do this, follow the steps below:
  1. Open your LabWindows/CVI project and select Edit>>Add Files to Project>>Library (*.lib)
  2. Browse to your import library, highlight it, and press OK to add it into your project
  3. Call your DLL functions in your code as you normally would, LabWindows/CVI will automatically look at the import library when resolving function calls at link time.
If the distributor of the DLL did not provide an import library, you can use LabWindows/CVI to generate an import library if you have the header file associated with the DLL. Refer to the article Creating Import Libraries for a DLL in LabWindows/CVI  for help on creating import libraries.

If you do not want to use the import library to call your DLL, refer to the article How Can I Access DLL Functions in a LabWindows/CVI Program Without Including the Import Library in the Project?
 

Additional Information

For LabWindows/CVI to know how to link a function call in your source code to an external DLL, you must provide a mechanism or an address for LabWindows/CVI to know where to look.

A DLL and its corresponding import library work together to let LabWindows/CVI link a function call to its definition. An import library's name will be the same as the name of its matching DLL, except that its file extension will be .lib instead of .dll.