LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to build DLL

I have a CVI project that I want to convert into a DLL.  I tried to do this by converting the CVI project into a VS 2005 project, but this was unsuccessful.  If I attempt to create a DLL from within CVI, I get an error message "Error compiling <filename> for DLL exports.  Error in header file <filepath> at line 281, column 4; syntax error; found 'identifier' expecting '}'.".  I have attached the portion of the header file that the error message points to.  The problem appears to be with "BOOL" in line 18.  This is a 3rd party header and I can't find the definition of BOOL in any file in my project, even though it compiles with no error when building a standalone executable.  Thanks.
0 Kudos
Message 1 of 6
(3,834 Views)
If you installed the Windows SDK and you #include windows.h in your main .c file, you'll get definitions of USHORT, ULONG, BOOL, etc.  BOOL may be in a .h file #included in one of your other files.  It doesn't need to be defined directly in a file in your project.  If you compile with debug, then you can right-click on BOOL and select Go To Definition.
0 Kudos
Message 2 of 6
(3,823 Views)
BOOL is defined as typedef int in cvidef.h, which is #included in one of my source files.  Why does the compiler sqauwk about this when building a DLL?
0 Kudos
Message 3 of 6
(3,820 Views)
What did you change when going from an Executabel to a DLL?
0 Kudos
Message 4 of 6
(3,818 Views)
As far as I know, the only thing I changed was the target type (from executable to DLL).  I changed BOOL to int in the code snippet attached to the original message.  This was again unsuccessful, but the compiler is now complaining about a missing parameter in the following prototype: LONG FAR GALILCALL DMCOpen(USHORT usController, HWND hwnd, PHANDLEDMC phdmc);.  According to the error message, HWND hwnd is the problem.  These functions are defined in a 3rd party static library that is listed as a source file in my project.  Is this setup incorrect for building a DLL?
0 Kudos
Message 5 of 6
(3,800 Views)

Do you have the Windows SDK installed?

Did you #include windows.h?  windows.h in the Windows SDK for CVI ends up also #including a host of other .h files including windef.h and cvidef.h

Are there any conditionals (like #if, #ifdef, etc.)  around any of your #include statements?

The oder of the .h files can also sometimes make a difference.  Try moving windows.h up close to the top.

0 Kudos
Message 6 of 6
(3,797 Views)