Subject: Re: [boost] version conflicts: is there a solution?
From: Edward Diener (eldiener_at_[hidden])
Date: 2009-06-24 23:52:30
Frank Mori Hess wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> On Wednesday 24 June 2009, Edward Diener wrote:
>> Lewis Hyatt wrote:
>>> Now, it seems to me that users of my library will still have to be aware
>>> of the fact that I used boost in my implementation -- specifically, if
>>> they happen to use different versions of the same boost libraries in
>>> their code, then the ODR is violated and the behavior is undefined.
>> If you are distributing a library without the source it means that you
>> are distributing a library in object format, whether shared or static.
>> In this case there is no conflict between the Boost header files you are
>> using internally and other uses of Boost since the end-user of your
>> library never sees the internal header files you are using.
> Having the definitions separated into different translation units doesn't seem
> to be enough to prevent ODR violations according to the standard. It gives a
> list of requirements for multiple definitions in different translation units
> in section 3.2.5.
I do not believe the C++ definition of a "translation unit" comes into
play when dealing with a library, but rather with header files included
within a source file. If the implementation is internal, as the OP
suggested, then I would assume that no header files for the
implementation are distributed and therefore no ODR violation for that
particular situation should occur.
Of course there may be conflicts when linking if internal details of a
library are exported but that is not something about which the C++
standard says anything AFAIK.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk