LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Errors when including malloc.h and crtdefs.h (Visual Studio 8\VC\include)

Hi,
 
I have a CVI dll (let's call it MyCVIdll) and I'm trying to use in it some functions from another dll created in Visual C++ (let's call this dll "VCdll"). I included VCdll.h in my MyCVIdll project as well as VCdll.lib. Since VCdll uses GTK and its associated glib.h, when I try to compile, CVI asks for a couple of GTK header files and I added the corresponding folders in the CVI Include Paths.
 
Everything goes fine and then one of this GTK headers (galloca.h) asks for malloc.h so I included also "C:\Program Files\Microsoft Visual Studio 8\VC\include" to the CVI include paths since malloc.h is there. But then I got several syntax errors in crtdefs.h (which looks like it's needed by malloc.h and is also in Visual Studio 8\VC\include).
 
I manually set #define _MSC_VER 1400 in MyCVIdll.h.
 
Does somebody know why this is happening? Should I manually add another #define somewhere? Actually this can be easily replicated in any CVI dll project, just add "C:\Program Files\Microsoft Visual Studio 8\VC\include" to the CVI include paths (options->environment->include paths), try to compile the project and you'll get several syntax errors in crtdefs.h. How to avoid those errors?
 
Environment: LabWindows CVI 8.1 and MS Visual Studio 2005
 
Thanks a lot for your help,
 
Delfino
0 Kudos
Message 1 of 2
(5,178 Views)
Visual C++ uses the C++ programming language, while CVI uses the ANSI C programming language. There are many difference between the two in syntax. While it is usually possible to go from C to C++, going the other way is next to impossible without many changes to the source code. DLLs are able to be called, but .h and .cpp files will not work in an ANSI C environment if their syntax is C++.

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 2 of 2
(5,160 Views)