Problem with shared libraries, exceptions, and global constructors
Fergus Henderson
fjh@cs.mu.OZ.AU
Tue Aug 19 04:31:00 GMT 2003
On 18-Aug-2003, Geoff Keating <geoffk@geoffk.org> wrote:
> David Edelsohn <dje@watson.ibm.com> writes:
>
> > [Sorry for the previous reply.]
> >
> > >>>>> Gabriel Dos Reis writes:
> >
> > Gaby> Pardon the question: It is a feature? I'm pretty sure I'm seen many
> > Gaby> bug reports where the symptoms described by Bernd were reported.
> > Gaby> What I'm saying is that, in the small your advice it quite
> > Gaby> straightforward to follow. For a large project however, I think that
> > Gaby> quickly gets out of hand. Isn't there anything that can be done?
> >
> > I am aware of some projects that explicitly do not link with all
> > dependent libraries due to circular dependencies.
>
> That's not really a reason, because you can always create stub
> libraries for bootstrapping purposes, and so long as you're careful
> about the order you link everything you can get a predictable startup
> sequence.
But having a predicatable startup sequence won't necessarily solve the
problem. Predictably wrong is still wrong! Consider the following two
translation units:
/* bug1.cc */
extern int bar();
int foo ()
{
try { throw 1; } catch (...) {}
return 0;
}
int x = bar();
/* bug2.cc */
extern int foo ();
int bar () {
try { throw 1; } catch (...) {}
return 0;
}
int z = foo ();
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
More information about the Gcc
mailing list