[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Tue, 21 Dec 2004 18:09:12 +0100
Mozilla Thunderbird 0.9 (X11/20041124)
1) I have a C++ library that makes use of global constructors.
This should also work when using static libraries, as long as the global
constructors are contained within the same archive member as the object
they construct, and everyone who uses the result from a static
initialization also has a reference to that object. I suppose you are
using a globally constructed object to perform some other initialization
that is not related to the object.
It should be possible to give the global object an "operator bool(void)
const", test that condition at appropriate places (i.e. once per
translation unit where you rely on the initialization) and define the
cast-to-bool operator in the same translation unit as the object's
That way, you will always pull in the constructor when it is required.
Description: OpenPGP digital signature
- whole_archive/-r, Christopher Mason, 2004/12/21
- Re: whole_archive/-r,
Simon Richter <=