Subject: Re: [boost] cmake target and binary name mangling
From: Peter Dimov (lists_at_[hidden])
Date: 2017-07-24 14:43:26


Niall Douglas wrote:

> But for developers needing to test just compiled binaries in various
> combinations and configurations, name mangling is an unalloyed win. As I
> mentioned, I only just shot myself in the foot with this last week because
> I wasn't mangling the true compiler compiling the binaries into the
> library names on Windows.

FWIW, I was just looking into an issue with an exe compiled with -std=c++11
linking to Boost.System compiled with -std=c++03. Since the class layout of
boost::system::error_category was different depending on whether
<system_error> was available, this lead to interesting times and baffling
stack traces.

Of course we don't actually have a b2 feature for -std, so its directory
encoding didn't help in this case. (And we don't encode this in the library
names either, but that can't be done until we have a feature.)

(Into the course of investigating this, I learned that libstdc++ performs
quite a bit of heroics to prevent C++11 std::string and C++03 std::string to
get mixed up in a similar way, or, if that's not possible, to make it work.
So this is not just a Windows issue. It's just that a lot of work is done
behind the scenes to keep things from breaking. Kind of like Boost.)