C++ Logo

std-proposals

Advanced search

Re: [std-proposals] "shared libraries are outside the scope of the C++ standard"

From: Lénárd Szolnoki <cpp_at_[hidden]>
Date: Tue, 18 Jul 2023 10:48:53 +0100
On Tue, 2023-07-18 at 04:37 -0400, Timur Doumler wrote:
>
>
> > On 18 Jul 2023, at 04:08, Lénárd Szolnoki via Std-Proposals
> > <std-proposals_at_[hidden]> wrote:
> > AFAIK one of the design goals of contracts is to allow companies to
> > still only release two builds: one debug and one release build, and
> > allow users the replace the contract violation handler for the
> > debug
> > library if they want to do so. I don't know if this is possible
> > with
> > replaceable functions within DLLs on Windows.
>
> That's a good question, but it is the responsibility of Windows & the
> Microsoft compiler and toolchain to figure out whether it's possible
> and how that would work — not the responsibility of the Standard.

I agree to some extent, especially that dynamic linking (the Windows
way in particular) is out of scope of the standard. However the
standard always considered the ABI of existing implementations, which
is similarly out of scope. Contract violation handlers are designed to
be "replaceable" with an intent. And the intent (as far as I
understand) is that they can actually be replaced, even in 3rd party
libraries, shared or static.

Regardless of pinning responsibility, I don't think anyone wants the
end result where debug DLLs on Windows have a fixed contract violation
handler that can only be replaced if one has the corresponding source
and/or object files. If this is not already clear on all sides, then I
think some discussion should start with MSVC implementers.

> Is it possible for operator new/delete? If yes, it should in
> principle be possible for the Contract violation handler, too.

Well, that's the question. I genuinely don't know if this is possible
to replace these functions within a DLL without having the
corresponding source and/or object files. If it is, then you can
dismiss my worries.

> Cheers,
> Timur

Received on 2023-07-18 09:48:58