The Secret Life of C++: Day 3: Initializing Globals
Global variables are tricky in C++, since they can have
constructors and destructors.
Simple Global Objects
Lets look at a simple example of initializing a global object:
global.cc,
global.s,
global.listing.
Basically, global constructors and destructors get "registered"
and called at program start and shutdown, using the _init and
_fini sections of the executable. Precisely how they get there is
linker magic. TODO: Figure out linker magic.
Richard Tibbetts
Last modified: Wed Jan 21 17:36:31 EST 2004