Building DLLs in LabVIEW 8.x or later

Publish Date: Jan 28, 2019 | 36 Ratings | 3.39 out of 5 | Print

Overview

You can use the LabVIEW 8.x Application Builder to create shared libraries (DLLs) from VIs, so you can call the VIs in the shared library using text-based programming languages, such as LabWindows/CVI, Microsoft Visual C++, and Microsoft Visual Basic.

Note: The LabVIEW Professional Development System includes the Application Builder. If you use the LabVIEW Base Package or Full Development System you can purchase the Application Builder separately using the related links below.

Refer to the LabVIEW Help, available by selecting Help»Contents and Index, for more information about building shared libraries, including descriptions of fields in the dialog boxes shown below.

Table of Contents

  1. Create a Project
  2. Creating a DLL in LabVIEW

1. Create a Project

  1. From the Getting Started screen, select File»New Project to open a blank project.
  2. Save the project.

Create a VI

  1. From the Project Explorer window, add a new VI to the project by selecting Project»Add to Project»New VI. If you would like to add a pre-existing file, select Project»Add to Project»Add File and skip to Creating a DLL in LabVIEW.
  2. Create a VI that converts a temperature from degrees Fahrenheit to degrees Celsius, which you easily can call from text-based programming languages.
  3. Use the following equation to create a VI to perform the conversion.
    Deg C = (Deg F - 32) / 1.8
    The block diagram and front panel should appear as follows.


     
  4. Assign the control and indicator to terminals in the connector pane. This step is necessary to create the DLL. Refer to the LabVIEW Help, available by selecting Help»Contents and Index, for more information about assigning controls and indicators to terminals.
  5. Save and close the VI to return to the Project Explorer window.

Back to Top

2. Creating a DLL in LabVIEW


Complete the following steps to create a DLL from the VI you built.

  1. From the Project Explorer window, right-click and select Build Specifications»New»Shared Library (DLL) as seen in the figure below.


  2. Specify names and a file path for the DLL in the Shared Library Information tab.

  3. Click the Source Files tab, select F to C.vi (or your pre-existing VI), and click the blue left-arrow near the Exported VIs section to add the VI to the DLL build. The following dialog box appears.

     
  4. Select the input parameter (DegF) and click the plus (+) button to add the input to the DLL. Also, select whether you want to pass the parameter as a value or a pointer to value. In this case, leave Value selected in the Pass By field. The function prototype changes at the bottom of the dialog box.

     
  5. Repeat the previous step for the other parameters. Notice the output for DegC is passed as a pointer by default.
  6. You also can select any of your output parameters as the return value of your function. The following function returns the DegC double number instead of a void. Therefore, you have two options for generating outputs from your function. You can add it as an output parameter or return it. The following function does both.

     
  7. Click the OK button in the Define VI Prototype dialog box.
  8. Click the Build button at the bottom of the Build Specifications window to create the DLL. LabVIEW creates the DLL in the destination directory along with a header and library file. In this example, the destination directory is c:\temp\F to C.

     

Related Links:
LabVIEW Application Builder for Windows
LabVIEW Application Builder for Mac OS
LabVIEW Application Builder for Sun Solaris 2
LabVIEW Application Builder for Linux

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit