automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: c++ link order problems


From: Bob Proulx
Subject: Re: c++ link order problems
Date: Tue, 28 Nov 2006 10:34:32 -0700
User-agent: Mutt/1.5.9i

Dan McMahill wrote:
> Ralf Wildenhues wrote:
> >Just curious: what's the reason for the ordering constraint?
> 
> When static objects use inheritance, the base class must be initialized 
> before anything can be derived from it.  At least that's what I've been 
> told.  On this particular project, I'm just the build system monkey and 
> not the c++ programmer ;)  In fact, I'm not a c++ programmer at all.  In 
> the c programs I've written the link order wasn't important.

IIRC C++ says that the initialization order of global static objects
is either implementation defined or undefined, I don't remember which,
and so basically one cannot count on the order.  This means that any
application that is depending upon this order is buggy.  A correct C++
program won't have a link order dependency.  This is probably the same
with Benoit Sigoure's issue with Sony's SDK too.

There is a C++ design pattern to guarentee initialization of global
objects and the iostreams use it these days.  In the old days before
the iostreams did this they could not be used in constructors or they
would core dump because of being uninitialized.  Sounds like you have
the same problem.  You should file a bug with the developers.  Have
them look to see how the iostreams do it these days and do something
similar.

Bob





reply via email to

[Prev in Thread] Current Thread [Next in Thread]