Boost logo

Boost Users :

Subject: Re: [Boost-users] Signals2 benchmark
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-02-22 18:40:53


On 11/02/2015 05:15, Nevin Liber wrote:
> I don't see how any of that addresses the problem I mentioned. If I use
> a third party library that
>
> #define FUSION_MAX_VECTOR_SIZE 20
>
> and I need to
>
> #define FUSION_MAX_VECTOR_SIZE 50
>
> how does that not lead to an ODR violation? This is still an issue even
> if that third party library only used Boost.Fusion in its implementation.

Yes and no. If a third party used Boost.Fusion in its implementation,
*and* Boost.Fusion is a header-only library, then such usage is safe
provided that the third party library is consumed only as a DLL / shared
object file, not as a static library.

But change any one of those things:
   1. linking statically rather than dynamically
   2. having both parties link dynamically to a Boost.Fusion DLL/SO that
has the same name but was compiled with different settings
   3. having the library expose Boost.Fusion in its own API
and you're setting yourself up for an ODR mess.

(Of course, linking the third-party library dynamically with a C++ API
has its own can of worms regarding compiler and CRT, as discussed in
another thread.)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net