Is it possible to implement conditional compilation in a static library depending on the defaults defined in the installation, without rebuilding this library?
------------------------- defines.h (LIB): #define VARIS10 ------------------------- libfile.h (LIB): #include "defines.h" ------------------------- libfile.cpp (LIB): #include "libfile.h" #ifdef VARIS10 int var = 10; #else int var = -10; #endif ------------------------- test.cpp (EXE): #include "stdio.h" void main() { extern int var; printf( "var = %d. ", var ); }
It would be desirable that when define is changed in defines.h, a different section of code in libfile is executed without rebuilding lib. Is it possible? Who does not understand, when building a lib with #define VARIS10, the program displays "10", and without it "-10" - regardless of whether exe was compiled with the presence or absence of define.