I have an opensource lib in .c, it has 2 parameters, but they are hardcoded in .h file with #define. They are around all code.
Change the parameter-> recompile.
How can I do best design of my cpp wrapper to this to which I can pass some parameter values and will have ability to call code without recompiling it?
I have an opensource lib in .c, it has 2 parameters, but they are
Share
You can make them
staticmembers of a class and initialize them in an implementation file.or you could declare a free variable with
externwhich you initialize in an implementation file.EDIT:
You can continue using macros if you don’t want to change the whole code, without requiring compilation every time you want to change the value:
EDIT:
I now see what you mean:
In this case, it’s impossible to do what you want, and you shouldn’t do it anyway, because you need to compile a different thing every time the define changes. So it’s not a matter of re-compiling, it’s a matter that you need to recompile.