libtool
[Top][All Lists]
Advanced

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

Re: whole_archive/-r


From: Simon Richter
Subject: Re: whole_archive/-r
Date: Tue, 21 Dec 2004 18:09:12 +0100
User-agent: Mozilla Thunderbird 0.9 (X11/20041124)

Hi,

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 constructor.

That way, you will always pull in the constructor when it is required.

   Simon

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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