-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Andrey Semashev via Boost Sent: Dienstag, 10. Oktober 2017 09:32 Subject: Re: [boost] [system] Header-only Boost.System by default ?
It will have the same address as long as get_basic_error_category() is called within the same module (dll, so, exe, etc.) If this function is compiled in different modules then there will be multiple instances of the category with different addresses.
On Linux and probably other Unix-like systems this can be solved by exporting the category instance, which is the default. I don't think this can be done on Windows - you'd have to export get_basic_error_category for that instead and it will make this code less friendly to header-only libraries.
And even if the "same address" thing was solvable (which I think it is, although not pretty and it would require interface changes), there is the problem with unloading DLLs/SOs. You'd have to pin every module that contains error categories. Which IMO is a side effect that you really don't expect and want, especially from a header-only library. Paul Groke