Use the Import Shared Library wizard to create or update a LabVIEW project library of wrapper VIs for functions in a Windows .dll file, a macOS .framework file, or a Linux .so file. You must provide the name of a shared library file and a header (.h) file for the wizard to parse. The Import Shared Library wizard supports only header files that are compatible with C/C++ syntax and use the C or Standard (_stdcall) calling convention.
Complete the following steps to create or update wrapper VIs for functions in a shared library file.
Select Tools»Import»Shared Library to launch the Import Shared Library wizard. The Specify Create or Update Mode page appears.
If you want to create wrapper VIs for a shared library you did not import previously, select Create VIs for a shared library. If you want to update wrapper VIs for a shared library that you did import previously, select Update VIs for a shared library and select the library from the list.
Note When you select the Update VIs for a shared library option, the wizard overwrites the previously-generated project library file and the existing VIs within that project library file. If you choose not to re-import generated VIs within the project library file, the VIs remain unchanged in the directory. The wizard retains the most recent settings for each individual function in a particular shared library. For example, if you have a shared library that contains three functions, you might update only the second function. The next time you run the wizard on that shared library file, it retains the original settings for functions one and three and the new settings for function two.
Enter the path to the shared library file you want to import in the Shared Library File text box, or click the Browse button to navigate to and select the file.
If you want to create VIs for a shared library that is not available on the local computer, such as if the shared library exists on an RT target, place a checkmark in the Shared library file is not on the local machine checkbox and enter the filename of the shared library file in the Shared Library File text box. You do not have to enter the path to the shared library file.
Note If you specify only a filename and not a path, the shared library file must be in the destination directory for the wrapper VIs or it must be available through the system search path.
Enter the path to the header file that you want to use with the shared library in the Header (.h) File text box, or click the Browse button to navigate to and select the file. The Import Shared Library wizard supports only header files that are compatible with C/C++ syntax and use the C or standard (WINAPI) calling convention.
Click the Next button to display the Configure Include Paths and Preprocessor Definitions page, and enter any include paths or preprocessor definitions you want the wizard to use when it parses the header file.
Click the Next button to display the Select Functions to Convert page. A dialog box appears to notify you that LabVIEW is parsing the header file.
The Select Functions to Convert page displays all the functions found in the shared library. If the wizard cannot import a function, the function appears in the list with a black glyph beside the item name. Select the function to display possible reasons for the error.
Note If you selected the Shared library file is not on the local machine option, this page lists only the functions declared in the header file. If you did not select the Shared library file is not on the local machine option, this page also lists functions referenced in the shared library file that are not declared in the header file.
(Optional) If the wizard cannot import one or more functions, click the Back button to add, remove, or update existing include paths or preprocessor definitions. If the errors are extensive, consider cancelling out of the wizard and editing the header file to be sure the file is well-formed before using the Import Shared Library wizard to generate wrapper VIs.
On the Select Functions to Convert page, select the functions you want to convert by placing a checkmark in the checkbox beside each function. Click the Check All button if you want to create wrapper VIs for all the functions in the list.
Enter a name for the project library file you want to create in the Project Library Name (.lvlib) text box. LabVIEW automatically includes all generated VIs within this project library file and uses a .lvlib extension for the file.
Enter the path to the directory in which you want to save the files the wizard generates in the Project Library Path text box. You also can click the Browse button to navigate to and select the directory.
(Optional) If you want to save a copy of the original shared library file in the destination directory, place a checkmark in the Copy the shared library file to the destination directory checkbox.
Note The wizard copies only the shared library file you specify. It does not copy any dependent shared library files. To ensure that the generated VIs are not broken, manually copy all dependent shared library files to the destination folder or add them to the system search path.
Select the error handling mode you want to use for the majority of the wrapper VIs from the Error Handling Mode pull-down menu. The Example Block Diagram field shows the basic block diagram the wizard generates for the wrapper VIs. If you want to select multiple error handling modes, you can re-run the wizard, select the Update VIs for a shared library option, and regenerate only the VIs for which you want to use a different error handling mode.
Review the configuration for the VIs and controls you want to create. Use the options on the Settings and Name and Description tabs to edit specific VI and control information for the majority of VIs you want to generate. An icon represents the data type for each control. An exclamation point glyph appears beside any data types that LabVIEW cannot process. For data types that LabVIEW does not support, create a custom control and add the control to the generated library after you complete the wizard.
Review the Generation Summary. If you want to make any changes, click the Back button to navigate back through the wizard.
On the Generation Summary page, click the Next button to create wrapper VIs for the functions you selected in the specified shared library file. The Generation Progress page shows the progress of the wizard as it generates the wrapper VIs. When the generation completes, the Finish page appears.
Place a checkmark in the Open the generated library checkbox if you want to open the generated library file when the wizard closes.
Place a checkmark in the View the report checkbox if you want to view a generation report when the wizard closes. If you select this option, the report opens in the default Web browser.
Click the Finish button to close the wizard.
Review the project library file and the generated wrapper VIs. If you selected an error handling mode that calls a separate error handling VI, you must open the error VI and modify it.