C++ shared library define and undefine functionality

view story

http://stackoverflow.com – I have a question regarding specific inclusion of functionality using shared libraries. I have my own small in-code profiler, that I am using in multiple projects so usually include as a shared library. Originally I wanted to turn of the profiling code using compile time flag. For example: #ifdef PROFILEAPP class Profiler { static void start() { ... } static void stop() { ... } }; #else class Profiler { static void start(){} static void stop(){} }; However, I this does not work if the lib is compiled before hand without defining the symbols. Note that my library is not header (HowTos)