Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2005-05-23 01:15:48


Robert Ramey ha escrito:

> I've looked at this a tiny bit. Here are the facts as I understand them
>
> a) According to www.boost.org/more/separate_compilation.html Autolinking
> will be enabled only if BOOST_ALL_NO_LIB and BOOST_SERIALIZATION_NO_LIB are
> not defined. The auto link code in the serialization library is written to
> conform to this

This is correct.

>
>
> b) Two platforms - MSVC and VC7 - fail to link for lack of libraries whose
> name signatures suggest auto-linking is enabed during compilation. That is
> neither of the two macros above seems to be defined.

I can confirm this; I've just checked it out in MSVC++ 6.0 against the
latest code in the CVS, and just about any piece of code involving
Boost.Serialization triggers autolinking by default (i.e. if the inhibiting
macros are not defined.)

>
>
> c) Other platforms which implement autolinking - VC 7.1, VC 8.0, Borland and
> CW don't seem to have any problems linking.

>
> So I believe there is some issue re autolink with these particular
> compilers. It may be an error in the serialization library or some
> compiler/preprocessor quirk.
>
> I went back to the posts referenced and at this point don't doubt my
> original conclusions.

I humbly request that you reconsider your design so that the following
guarantee is honored:

* (A) Any code including *only* boost/serialization/*.hpp headers won't
trigger autolinking of Boost.Serialization.

The following is a rationale for this policy: a 3rd party library that
provides *intrusive* serialization capabilities will most likely need
to include some of boost/serialization/*.hpp. If those headers
trigger autolinking, the user will face the annoying fact that
Boost.Serialization is autolinked even if she didn't explicitly try
to use serialization at all.
Granted, if the serialization capabilities of the 3rd party library
are not taking advantge of, autolinking will ultimately have no effect
on the final binary, but the point is that the user will be forced nonetheless
to have the Boost.Serialization lib built and available. This is most
unfortunate in the case the 3rd party library is a header-only lib,
since the user may very well be using it without having built anything
from Boost. This is exactly what's happening now with Boost.MultiIndex.

Autolinking is triggered by the (implicit) inclusion of
boost/serialization/config.hpp. This header is in turn included by
void_cast.hpp and extended_type_info.hpp, and if you pull out from this
thread it turns out virtually any boost/serialization/*.hpp header will
trigger autolinking.
To honor (A), you just have to remove the inclusion of
boost/serialization/config.hpp by the aforementioned void_cast.hpp
and extended_type_info.hpp. From what I can see, the inclusion
is done so as to bring in the definition of BOOST_SERIALIZATION_DECL,
so in principle having this macro defined in a separate header would suffice.

If (A) is honored, autolinking will be triggered only when including
boost/archive/*.hpp headers, which IMHO is just fine, since these are
a sure sign that the user (not the 3rd party library) is explicitly requesting
serialization capabilities and will welcome the autolinking stuff.

Hope this helps a little. Thank you,

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk