Troubleshooting the Import Shared Library Wizard

LabVIEW 2018 Help


Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)


LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help
LabVIEW 2020 Help

The following are some common issues you might face while using the Import Shared Library wizard. If the suggested solutions do not help you, you may need to debug the shared library.

The Wizard Cannot Locate any Functions

The Functions list on the Select Functions to Convert page of the Import Shared Library wizard lists all the functions in the shared library file you specify. If no functions appear after the wizard parses the header file, check that the path to the shared library file is correct and that the library contains functions.

The Wizard Locates Functions that It Cannot Import

The Import Shared Library wizard lists all the functions in the shared library file you specify, but it can import only those functions that the wizard can parse correctly from the header file. The warnings that appear when you select a function in the Functions list on the Select Functions to Convert page can help you determine possible problems. Check that the header file contains all the necessary function declarations. Each function declaration must include the calling convention, the data type of the return value, and defined parameters. To correct the header file, you can edit the file directly or use the Configure Include Paths and Preprocessor Definitions page of the wizard to add symbol definitions.

The following example code from a header file only compiles functionA if you define WIN32:

#ifdef WIN32
int functionA(int para);
#endif

If you want LabVIEW to import functionA but the header file does not define WIN32, you can either edit the header file directly to define WIN32, or you can define WIN32 in the Import Shared Library wizard. To define WIN32 in the wizard, enter WIN32 in the Preprocessor Definitions text box on the Configure Include Paths and Preprocessor Definitions page.

The following example code shows another function in a header file. In this situation, you did not define NIAPI, so LabVIEW does not recognize the symbol:

NIAPI int functionA(intpara);

If you want LabVIEW to import the function, you can add NIAPI=_stdcall to the Preprocessor Definitions text box to define NIAPI.

The Wizard Cannot Locate Declared Functions

The Functions list only shows functions that appear in the shared library file. If the header file contains declarations for functions that are not in the shared library file, the wizard does not list those functions. To see all the functions declared in the header file regardless of whether they exist in the shared library file, place a checkmark in the Shared library is not on the local machine checkbox on the Select Shared Library and Header File page of the wizard. The wizard then lists all the functions declared in the header file when you return to the Select Functions to Convert page. Be sure to remove the checkmark from this checkbox before you generate the wrapper VIs.

The Wizard Cannot Locate Nested Header Files

If the header file you specify contains nested header files, you must provide the paths to the nested files in the Include Paths text box on the Configure Include Paths and Preprocessor Definitions page of the wizard. If you do not specify include paths for nested header files, the wizard cannot parse the header file correctly.

WAS THIS ARTICLE HELPFUL?

Not Helpful