Hi, this is a question for the gnu linker geek:
I am trying to add gnucap to FlightGear as posted before. It compiles cleanly and links fine, but there is one issue. Gnucap uses commands which are implemented in separate files. These commands get registered into a global command registry. Here is a code snipped for the "clear" command: class CMD_CLEAR : public CMD { public: void do_it(CS&, CARD_LIST* Scope) { // .. do something fancy here } } p0; DISPATCHER<CMD>::INSTALL d0(&command_dispatcher, "clear", &p0); The class CMD_CLEAR implements the CMD interface which requires the do_it() function. The DISPATCHER template contains a INSTALL class, it's constructor performs the registration into the registry. In theory, when the INSTALL class is instantiated as d0, the actions in the constructor are performed. Unfortunately, this does not happen when linked against FlightGear. I tried to rename d0 into something more uniqe and grep'ed the created object and library for the variable which were found there, but not in the fgfs executable. This lead me to the conclusion, that the linker optimizes the unused variable from the executable. Is there any magic switch to pass to the g++ linker telling him not to optimize unused variables, preferably for a certain set of files or a single library? Torsten ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel