Subject: Re: [boost] [any] new version
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2011-09-01 12:46:03
On 09/01/2011 12:30 PM, Mathias Gaunard wrote:
> On 01/09/2011 05:26, Andrey Semashev wrote:
>> In addition, on most platforms there will be multiple instances of
>> type_id<T>::value for a single given T if the application uses
>> type_id<T> in multiple modules.
> That's not a problem, type_id<T>::value is a weak symbol.
It doesn't matter. I wasn't speaking of different translation units, but
different modules (i.e. dll, so, dylib). Unless you do explicit
exporting/importing of this symbol, you'll have separate instances.
>> These instances will be initialized
>> independently and most likely will have different ids. And since
>> next_id() is also module-private, inter-module passing of boost::any
>> becomes totally impossible.
> You could make next_id a function with weak extern linkage, which should
> be able to make it work.
The problem is not with the function itself but rather its local static
variable, which is subject to the same issues as with type_id<T>::value.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk