Re: /bzr/squid3/trunk/ r9573: SourceLayout: acl/, take 1

From: Henrik Nordstrom <henrik_at_henriknordstrom.net>
Date: Tue, 17 Mar 2009 10:26:50 +0100

mån 2009-03-16 klockan 19:57 -0600 skrev Alex Rousskov:

> libtool uses -whole-archive when adding a convenience library to a
> shared library but does not use that option when adding a convenience
> library to an executable.

It has to, as there is no dependencies to be resolved when building a
shared library.

> There are more caveats depending on whether
> the convenience library is "regular" or "static" (search "info libtool"
> for -static).

The definition of a "convenience library" is a static non-installed
library, only used as input in further linking.

The libtool documentation is very clear that the only difference between
a libtool "convenience library" and a normal ar+ranlib archive is that
the convenience library also carries dependencies on any other
libraries.

> "When you link a program with a [static convenience] library, libtool
> will actually link all object files and dependency libraries into the
> program."

Seems to me to be only a weak attempt in explaining the difference
between the default shared (if possible) and static (including static
convenience).. But the above is true in most situations, except for when
there is no link-time dependencies indicating the code is needed..

The more I think on this the more I am of the opinion that using
self-registering static/global objects as method of initialization &
registration is generally a mistake. Better if each such class have a
method for initialization, with initialization order explicitly coded in
the main program. Also makes transition to runtime loaded modules easier
and less intrusive as each module can assume the modules it registers
into has been properly initialized already which means it can do a full
initialization.

Regards
Henrik
Received on Tue Mar 17 2009 - 09:27:01 MDT

This archive was generated by hypermail 2.2.0 : Wed Mar 18 2009 - 12:00:03 MDT