Hello,
I have some inline functions declared in the header file and need to access some variables declared in the codes that include the header file, is there a where to do so?
For example:
Code:
module.h:
inline t_print() { printf("modid = %d\n", modid); }
// this should print 1 or 2
inline some_func() { t_print(); };
module1.cpp:
static long modid = 1;
t_print(); // this should give modid = 1
module2.cpp:
static long modid = 2;
t_print(); // this should give modid = 2
Any suggestion out there? Thanks.