ld linker question: the –whole-archive option

There are legitimate uses of –whole-archive when linking executable with static libraries. One example is building C++ code, where global instances “register” themselves in their constructors (warning: untested code): handlers.h typedef void (*handler)(const char *data); void register_handler(const char *protocol, handler h); handler get_handler(const char *protocol); handlers.cc (part of libhandlers.a) typedef map<const char*, handler> HandlerMap; HandlerMap … Read more