
Emil Dotchevski wrote:
However I don't see how this can be done automatically. I suppose you're using some kind of global object to do the registration (because you say it's done on startup). However, the global object isn't guaranteed to be initialized at startup, all you know is that it will be initialized before you enter any function from foo.cpp.
I didn't see how to do this either. Dave Abrahams finally did it. Look in export.hpp
In fact I have seen Metrowerks (correctly) consider a similar "automatic" registration dead code and remove all foo.cpp code from the executable (not just the global object, the entire class foo is removed.)
I notice that export.hpp has some special code for Metrowerks - maybe that's related to your point. Look in export.hpp Robert Ramey