Boost logo

Boost :

From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2007-05-16 10:19:54


On Wed, 16 May 2007 05:51:22 +0200
Bjørn Roald <bjorn_at_[hidden]> wrote:

> You could read this thread.
>
> http://lists.boost.org/Archives/boost/2005/09/93902.php

Interesting. I have a similar problem. I build an distribute a library
that is used throught the company, and it uses boost internally. Other
groups in the company may be using different versions of boost than the
one this library is built with.

For that reason, the interface MUST NOT use anything in boost. The
implementation can only use things that instantiate templates based on
internal types (i.e. not visible in the interface). This is really bad.

If sorely wish there was a way to use different versions of boost.

One of the things I did in this particular library, is version itself
with a macro like so in say, foo/common.hpp

#define FOO_NAMESPACE PP_build_namespace(foo, FOO_MAJOR_VERSION)
namespace FOO_NAMESPACE { }
namespace foo = FOO_NAMESPACE;

This means that all code can use the alias "foo" as the namespace name.

The only problem is that the namespace can not be reopened with "foo"
but must be reopened with the macro name...

namespace FOO_NAMESPACE { namespace detail {

// ...

} }

This does not seem to be too big of a problem, since opening the
namespace means you are changing it, and it should not be done in a
willy-nilly fashion.

This allows multiple versions to be used in the same application without
ODR violations, and also makes sure the proper libraries are linked,
because the linking will fail if the right version is not provided. It
allows backward compatible interfaces as long as the maintainer is
responsible about naming the versions.

I'm not sure how much traction a sudggestion like this would gain in the
boost community, but I certainly would love to see some way of
versioning the libraries.

I am certainly open to any ideas of a BETTER approach, both for my own
libraries, boost, and other third party libraries with similar problems.

How do YOU (plural) manage different versions of third party libs in
your applications?

What I would REALLY like to see is expanded language support for this
concept. Maybe allow an alias to open the namespace for which it is
currently aliased...


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