Boost logo

Boost-Build :

Subject: [Boost-build] Boost Namespace renaming script
From: Artyom (artyomtnk_at_[hidden])
Date: 2009-05-24 05:33:01


Today Boost does not provide any backward binary compatibility. This
makes big problems in shipping 3rd part libraries that depend on Boost
because library user must use the same version of Boost as that 3rd
part library was compiled with.

The problem is become even more critical for ELF platforms (UNIXes)
where all symbols are exported by default.

I had written a small Python script that switches boost namespace
to other, allowing 3rd part project include it without collisions
with primary Boost namespace.

The script passes over the source tree of boost and changes each
include path from <boost/foo/bar.hpp> too <newnamespace/foo/bar.hpp>
and renames all macros and identifiers from some_BOOST_something to
some_NEWNAMESPACE_something and some_boost_something to

It does not touch comments (copyright) and strings unless the string
is in form "boost/.*" which is usually some reference for include.

I've run this script on the 1.37 and 1.39 versions of boost and
successfully build following libraries: threads, date-time,
program-options, regex, system, iostreams, serialization

I had also run some regression tests on shared_ptr, bind and others.

The source code is available at:

You run it as:
   ./rename /path/to/boost/source new_namespace_name

And it updates in C++ source file. After that you need to rename
main header library from "boost" to "new_namespace_name" and actually

Few points:

1. It is only alpha version script, I just want to see feedback and
2. I do not update build scripts. I assume that each library that
   tryes to import its own version of Boost would provide its own
   build system.
3. The build scripts should be updated differently because they have
   different syntax and grammar. The required changes are to
   fix different build defines

Please, give feedback proposal. If there someone who is familiar
with Boost.Build systems can actually help, this would be very good.

Today there is a big problem with working with different versions of
Boost. It should be solved.



Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at