Generate a Shared Library From a LabVIEW Project

Updated Apr 12, 2023



  • LabVIEW
  • LabWindows/CVI


Visual Studio

How do I generate a shared library (DLL) from my LabVIEW project code that can be called in other environments, such as LabWindows™/CVI™ or Visual Studio?

A shared library is a file containing executable program modules that any number of different programs can use to perform some function. On Windows OS a shared library is called a DLL. Please note that calling a LabVIEW-built shared library requires the LabVIEW Run-Time Engine.

To generate a DLL from your LabVIEW project code, each function that you want to be able to call from the DLL will need to be contained in a separate VI in your LabVIEW project. Below is an example of a project tree with separate functions.


For each function VI, ensure all required inputs (controls) and outputs (indicators) are wired to the terminal connection pane in the front panel of LabVIEW. The below example function will be generated in the DLL as Add(X,Y).



In the Project Explorer, right-click Build Specifications and select New»Shared Library (DLL).



In the Build Properties dialog box, navigate to the Information category to name the build and the DLL, as well as where it is saved.



Next, navigate to the Source Files category to select what VIs you want to export to your DLL as functions.



You may optionally preview the build files in the Preview category.



You can now test the DLL by calling it in another environment such as LabWindows/CVI. Please read through Calling a LabVIEW DLL from a LabWindows/CVI or Other C Project to ensure you are calling it correctly.


Note: The generated shared library is not a .NET assembly if you want to create a .NET DLL you need to select .NET interop assembly when creating a new build specification. Managed code (.NET) can easily call functions contained in unmanaged DLLs, such as Win32 API and custom DLLs. To do this, the .NET Framework provides a mechanism called P/Invoke (for Platform Invoke). Nevertheless, if you are going to use .NET and have the LabVIEW source code it is recommended to generate a .NET interop assembly.