Create a shared library to make your LabVIEW code available as a reusable asset for other callers to use.

Note This build output requires Application Builder. LabVIEW Professional edition includes Application Builder. If you use another LabVIEW edition, you can purchase the LabVIEW Application Builder Module separately at ni.com.

Before using LabVIEW to create a shared library, such as a .dll, do the following:

  • Create code to include in the shared library you create. Include the code in a project.
  • Understand best practices for coding paths in your source code.
  • Prepare the source files for distribution.
  • Save the project. To create a build specification, the project must be saved.

This procedure describes the basic options to create this build specification. For details on each configuration option for the build specification, refer to the links for each page of the dialog box.

To use your LabVIEW project to create a shared library, complete the following steps.

  1. In the Project Explorer window, right-click Build Specifications and select New » Shared Library (DLL).
  2. Required: Under Source Files, specify which project files to include in the shared library.
    • Use Exported VIs to define the VIs that users can access with the shared library. Customize the parameters of any exported VIs with Define Prototype....
    • Use Always Included to include dynamic VIs and support files.
    Note You must add certain VIs to the Always Included listbox on the Source Files page in the following situations:
    Item When to Always Include
    Dynamically loaded VIs

    You can also distribute dynamically loaded VIs for an application by including them within a source distribution.

    Custom run-time menus If you save the custom run-time menu for a front panel control as a separate run-time menu file (.rtm).
    Notice If you customize the prototype of a VI with Define Prototype..., certain changes to the VI revert the VI back to the default prototype. For more information, see Connector Pane Changes That Reset the Prototype of a VI in Shared Libraries.
  3. (Recommended) Under Information, name the shared library and the build specification, and choose the highest-level save directory for the build product.
  4. (Recommended) Under Destinations, set up the directory structure for the files that the build generates.

    Destination path defines the location of these files relative to the overall save directory for the build you specified in step 3.

    Note If you intend to include this distribution in an installer, specify the build output of the build specification relative to the primary destination of the build specification. For details, see Caveats and Recommendations for Building Installers with LabVIEW.
  5. (Recommended) Under Source File Settings, edit destinations and properties for the files and folders included in the shared library.

    LabVIEW displays different options based on the type of item you select in Project Files.

  6. Optional: Under Version Information, specify the version of the application and provide metadata about your organization.

    For more information about setting versions, refer to Managing Application Versions.

  7. Optional: Under Additional Exclusions, configure options to leave out certain items from the distribution.

    Excluding items can reduce the size of the distribution, improve load times, or reduce memory usage.

  8. Optional: Under Pre/Post Build Actions, define VIs to run before or after the build.
  9. Optional: Under Windows Security, configure security features, such as the digital signature and the manifest file for the application.
  10. Optional: Under Run-Time Languages, set the language preferences for items within the distribution, such as dialog boxes and menus.
  11. Optional: Under Advanced, configure settings for debugging, logging, aliases, compatibility, and more.

    For more information about debugging, see Debugging Applications and Shared Libraries.

  12. Optional: Under Preview, generate a preview of the build to ensure that it appears as you expect.
  13. Apply any updated settings for your build specification by clicking OK.
    The dialog box closes and the build specification name appears in the project under Build Specifications.
  14. Build the distribution.
    OptionDescription
    Interactive
    • Right-click the build specification and select Build.
    • From the Package window, click Build.
    Programmatic Use the Build VI or the ExecuteBuildSpec command line operation.

After building a shared library on a Windows system, consider building an installer when distributing your builds. If you build an installer, you can include any components users will need to run your application. For example, include the LabVIEW Runtime if you will be running your application on a computer that does not have the complete LabVIEW development system installed.

For more information, refer to Creating Installers with LabVIEW.