I'm trying to find out a little bit more about how the preprocessor works in relation to shared object libraries generated by GCC on GNU/Linux.
I've been unable to find a clear, concise answer to this.
If I use preprocessor statements like:
#ifndef __OPTI_MY_VARIABLE #define __OPTI_MY_VARIABLE 1 #endif
And I compile a shared object file with this and link to it with another program in which I declare:
#define __OPTI_MY_VARIABLE 2
Will my program then use the value 1 or 2 after compiling the main program which uses the shared object library?
If it uses the value 1, is there a way to construct the code such that it will use the value 2, for example by not using pre-processor statements? In other words, is there a way for me to declare default values unless another global variable by the same name overrides it, or must this info be passed to the function in the shared object?