Boost logo

Boost :

Subject: Re: [boost] [system] Would it be possible to trial a breaking change to Boost.System and see what happens?
From: Peter Dimov (lists_at_[hidden])
Date: 2018-01-14 16:30:11

Niall Douglas wrote:

> If you link all your DLLs with the static MSVC runtime so each gets a copy
> of a system_category implementation, _Immortalize still ensures that only
> one instance ever appears to exist in the process. So each error category
> always gets its unique address in the process. At least, this is what I've
> been told.

This was an interesting claim so I looked into it.

No, categories from DLLs using the static runtime do not have the same
address, and _Immortalize doesn't help with that.


e1: 'system:0'; { 0, 560F6B00 }
e2: 'system:0'; { 0, 57E86B00 }
No errors detected.

They do, however, compare equal.

The equality comparison simply makes sure that all system categories compare

bool operator==(const error_category& _Right) const _NOEXCEPT
    { // compare categories for equality
    return (_Addr == _Right._Addr);


/* constexpr */ error_category() _NOEXCEPT // TRANSITION
    { // default constructor
    _Addr = reinterpret_cast<uintptr_t>(this);


    uintptr_t _Addr;

    enum : uintptr_t
        { // imaginary addresses for Standard error_category objects
        _Future_addr = 1,
        _Generic_addr = 3,
        _Iostream_addr = 5,
        _System_addr = 7

Perhaps we need to do something similar in Boost.System; the combination of
link=static and runtime-link=shared is disallowed at Boost Jamroot level,
but it could still help the "header-only in DLLs" case.

Boost list run by bdawes at, gregod at, cpdaniel at, john at