Boost logo

Boost :

Subject: Re: [boost] [any] new version
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-09-05 07:40:39


On 01/09/2011 19:00, Andrey Semashev wrote:

> Suppose you use boost::any with types int and string in your main
> executable and in one of the dlls linked in. Exe and dll will have
> separate instances of both type_id<int>::value and
> type_id<string>::value

Which is no different than when compiling multiple translation units.

> Depending on the circumstances,
> type_id<int>::value in exe may become initialized equal to
> type_id<string>::value in dll, for instance.

In practice, a good linker is supposed to remove duplicate weak symbols.

> In practice, I'm aware of only one platform (Linux), which will by
> default attempt to maintain a single instance of these ids, but even
> there care must be taken.

Quite the opposite, only DLLs don't support weak symbols.


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