LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows CVI Pre/Global Include

Hi,

 

I am looking for a way to have the compiler tack on an include statement for a global header file, the equivalent of manually putting #include "some_file.h" in all of my source files, which I don't want to do since this code is common and used among a log of projects so I'm trying not to clutter it or change it's source code since it already functions well for all other programs it's used in.

 

Code repositories which I am inheriting use functions, such as fabsf() and powf(), but it appears I only have access to the double versions: fabs() and pow().

 

It would make the code too cluttered to surround all uses of the math function variants which I don't have access too to use the other version:

 

#if defined(_THEIR_CODE_)
/*...*/fabsf(some_variable)/*...*/
#elif defined(_MY_CODE_)
/*...*/fabs(some_variable)/*...*/
#endif

Instead, I have made a file, lets call it compatibility.h, which includes macros which define these to use the double version:

#define atan2f(arg, args...) atan2(arg, #args)
#define sqrtf(arg, args...) sqrt(arg, #args)
#define fabsf(arg, args...) fabs(arg, #args)
#define powf(arg, args...) pow(arg, #args)

Now again I cannot clutter up the code adding a macro to check if it's my version and then #include "compatibility.h", instead I need to have the compile/build process automatically include this file in all of my source code (referred to as "global include" or "pre include" in other contexts)

 

From everything I've looked at I have not found a solution to this.

 

LabWindows CVI 2017 uses Clang 3.3 so I have been also looking to see if there is a command line option I could provide which would allow me to specify a pre/global include but haven't found that either.

 

 

Thanks!

0 Kudos
Message 1 of 2
(2,405 Views)

You need to set compatibility.h as precompiled header in your project. It does exactly what you described

0 Kudos
Message 2 of 2
(2,374 Views)