Replies: 3 comments 2 replies
-
From a build perspective using the UCRT is orthogonal to either the |
Beta Was this translation helpful? Give feedback.
-
Hi @grafikrobot How exactly is linking to the UCRT orthogonal? Not at all: It's definitely a variant of |
Beta Was this translation helpful? Give feedback.
-
@grafikrobot IIUC @trueqbit wants IIRC Python extensions ( |
Beta Was this translation helpful? Give feedback.
-
I am proposing a new build variant on Windows that allows a "hybrid" runtime approach.
I am uncertain where to start this discussion, because it affects both, boost-config and bfgroup-b2/boost-build.
Motivation
Since Windows 7, Windows has delivered the ABI-stable subset of the C runtime as part of the operating system in the form of the "Universal CRT".
This allows libraries to be created without the ballast of a statically linked in runtime and without the need to deploy the "VC runtime", i.e. a kind of lightweight yet self-contained hybrid.
This approach is officially used by the "Windows App SDK", and I am using it successfully for all FireDaemon Technologies LTD products.
Also openssl accepted the new build configuration.
More information about Hybrid CRT can be found here: https://github.com/microsoft/WindowsAppSDK/blob/main/docs/Coding-Guidelines/HybridCRT.md.
This is very easy to achieve:
/MT
./NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib
.From a build perspective, this state can actually already be achieved by specifying
variant=debug link=shared runtime-link=static linkflags="/NODEFAULTLIB:libucrtd.lib /DEFAULTLIB:ucrtd.lib"
to b2; when building shared DLLs the additional argument--allow-shared-static
needs to be passed.Linking to such hybrid libraries is a bit more tricky.
Linking to "static" libraries would already work, but importing hybrid "dynamic" libraries is rejected by config/auto_link.hpp because it determines that "Mixing a dll boost library with a static runtime is a really bad idea...". With the dependency on the Universal CRT this is no longer true.
Proposal
Anyway, changing the traditional meaning of "static runtime" linking shouldn't be changed, and unfortunately there's no built-in CPP macro that is set by the msvc toolchain for that specific combination of runtime link flags.
Rather I propose:
BOOST_WINDOWS_LINK_UNIVERSAL_CRT
that must be defined by importing projects.'h'
denoting the "hybrid" nature of runtime linking.runtime-link=hybrid
a. writes runtime-tag
'h'
into the resulting library file name.b. implicitly adds
linkflags="/NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib"
.Beta Was this translation helpful? Give feedback.
All reactions