Path: utzoo!attcan!uunet!decwrl!shelby!neon!eclipse!hall From: hall@eclipse.stanford.edu (Keith Hall) Newsgroups: comp.lang.c++ Subject: Re: Are global class objects special? Message-ID: <1990Oct2.162451.3101@Neon.Stanford.EDU> Date: 2 Oct 90 16:24:51 GMT References: <26729@mimsy.umd.edu> <28241@pasteur.Berkeley.EDU> Sender: news@Neon.Stanford.EDU (USENET News System) Organization: Stanford University Lines: 22 In article <28241@pasteur.Berkeley.EDU> jbuck@galileo.berkeley.edu (Joe Buck) writes: > >In article <26729@mimsy.umd.edu>, wilson@brillig.cs.umd.edu writes: >> I'm just generally puzzled about execution of code before main >> in invoked. Apparently, I can't count on all necessary >> system initializations being performed before my constructors >> are called. > >This is a libg++ problem, though it can bite users of cfront in >some situations as well. I've worked around the problem by >modifying gnulib3.c to call global constructors in >reverse order (so libraries will be initialized before your code). >You can also work around the problem by making sure your .o files >are handed to the linker in an order that works (constructors are >called in the order that the .o files are given to the linker). Having the constructors called in the proper order seems so fundamental that I don't understand why that behavior is not already ensured by the compiler/linker. Buck, can your mods to gnulib3 become a standard part of libg++? Keith