Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-03-07 12:29:12

----- Original Message -----
From: "Fernando Cacciola" <fcacciola_at_[hidden]>
To: "boost" <boost_at_[hidden]>
Sent: Thursday, March 07, 2002 11:36 AM
Subject: [boost] bind placeholders/tuples ignore and BCB pch

> Hi,
> I just ugraded to boost 1.27.0... (I use boost heavily at production code
> I need to upgrade carefully)
> As I reported before, Borland cannot create a precompiled headers if
> data is contained in the header to precompile.
> There are at least two boost libraries which declares static data: tuples
> and bind.
> I noticed that these "problems" remain in release 1.27.0.
> I also noticed that the bind placeholders have changed in the new version,
> but the change doesn't solve the Borland problem.
> As it has been mentioned before, the solution is to declare those
> 'extern' (except once in some TU).
> As a boost user, I MUST include these two libraries in a pch, since they
> used right from the start, therefore, each time I upgrade to a new version
> of boost, I have to manually apply the changes.
> In the next message, I'll attach the files:
> (boost/tuple/detail) tuple_ignore.hpp
> This NEW header contains boost::tuples::detail::swallow_asign and
> boost::tuples::ignore.
> The corresponding definitions in tuple_basic.hpp and
> tuple_basic_no_partial_spec.hpp must be removed, and this header must be
> included in boost/tuple/tuple.hpp.
> (boost/bind) placehoders.hpp
> Both headers have been extended to allow the static variables be declared
> 'extern' and '__export' (the later is required if the definition is
> in a dll, as it is my case)
> Basically, the user should define BOOST_XXX_EXTERN before including the
> library headers, where XXX is either TUPLE or BIND, in order to introduce
> external and dll-exported definitions of those variables. Additionally,
> headers must be included somehwere without the _EXTERN macro defined.
I just find a problem with the patch I posted.
Without BOOST_XXX_EXTERN, the variables go into the unnamed namespace, so
they don't match with their extern declarations.
The complete solution would have to be:

Use BOOST_XXX_EXTERN to declare variables as extern.
*additionally*, use also BOOST_XXX_EXTERN_DEFINITION in the TU where you
wish to give the definitions for those variables.


#include "boost/bind.hpp" // placeholders are external
// precompiled header up to here.

// precompiled header up to here.
#include "boost/bind.hpp" // placeholders have no-linkage so they are
defined here.

I'm attaching here the updated headers.

Fernando Cacciola
Sierra s.r.l.

Boost list run by bdawes at, gregod at, cpdaniel at, john at