Thread View: gnu.g++.help
1 messages
1 total messages
Started by Bradley D. Keister
Tue, 18 Aug 1992 05:38
static constructors and libraries
Author: Bradley D. Keister
Date: Tue, 18 Aug 1992 05:38
Date: Tue, 18 Aug 1992 05:38
34 lines
2046 bytes
2046 bytes
Several weeks ago I posted a notice that modules in libraries were not initializing static constructors under g++ 2.2.2 on a SPARC, though they did so with g++ 2.2.2 on a DECstation. The details are included below. Since I received no feedback at that time, and I need several library modules which have such constructors for a major project, I've decided to post this query. Am I doing something improper? Is there a workaround for this, short of compiling all modules with static constructors and linking them in directly? Brad Keister Department of Physics Carnegie Mellon University Pittsburgh, PA 15213 (412) 268-2772 (office) (412) 681-0648 (FAX) internet: keister@poincare.phys.cmu.edu BITNET: keister%poincare.phys.cmu.edu@CARNEGIE >> A library which I have developed makes occasional use of static >> constructors (which generate constants use frequently in >> applications). I've just noticed that the SPARC version of g++ >> generates code which initializes those constants to zero, but >> initializes correctly if the .o file is linked in directly. If I do >> the same thing with the DECstation version of g++, I get correct >> initialization from the code in the library, and the same is true >> using cfront on the DECstation. >> >> The code which uses the numbers from the static initialization is not >> itself in any constructor; in fact, it's in main(). I may be >> misunderstanding the warnings about implementation dependence of >> static constructors, but I'm surprised that two machine versions of >> g++ (both 2.2.2) handle it differently.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads