Syntax Error or Link Error When Calling a DLL in LabWindows/CVI
Primary Software Version: 9.0
Primary Software Fixed Version: N/A
Secondary Software: N/A
I am calling a DLL from a LabWindows/CVI project. I have included the import library (
"headerfile.h"(1,20) syntax error; found 'identifier' expecting ';'
First double-check that you have included both the header file and the import library for the DLL in your project (Refer to the Project Tree inside LabWindows/CVI). If one of those files is missing, add that file to your project by selecting Edit » Add Files to Project or by right-clicking the project name inside the Project Tree and selecting Add File....
If the above files are included, the second possible issue could be dealing with the compiler's calling convention. The default calling convention for DLLs is set under the Options » Build Options menu as shown below.
For both compilers, the default calling convention is normally
If the DLL you want to include uses WINAPI, then you will need to use the _stdcall calling convention as described above. You can check if your DLL uses WINAPI by opening the header file and looking at the function prototypes. If the function prototypes are of the form datatype WINAPI functionname(parameters); then the DLL requires _stdcall. To build successfully, WINAPI must be replaced with _stdcall for each function prototype in the header file.
Leaving WINAPI in the function prototype will result in a syntax error for each function: "headerfile.h"(1,20) syntax error; found 'identifier' expecting ';'. Where headerfile.h is the name of your header file.
If you are unsure as to the calling convention of the DLL, contact the author of the DLL or attempt to try the other calling convention.
KnowledgeBase 2RCKK3TL: Calling Conventions in LabWindows/CVI
KnowledgeBase 1ZQDQPY5: Linking to Functions Defined in a DLL From LabWindows/CVI
White Paper: Building a DLL with LabWindows/CVI 8.5 for use with LabVIEW 8.5
Report Date: 04/10/2006
Last Updated: 11/17/2016
Document ID: 3W9DPTG2