-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the Universal C Runtime #888
Conversation
To other reviewers: If you're like me, you keep falling for this trick. There's no security issue here, see #573 (comment) for more context. 👍 |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
...ynamicDependencyLifetimeManager.ProxyStub/DynamicDependencyLifetimeManager.ProxyStub.vcxproj
Show resolved
Hide resolved
...ynamicDependencyLifetimeManager.ProxyStub/DynamicDependencyLifetimeManager.ProxyStub.vcxproj
Show resolved
Hide resolved
I am in favor of this strategy, and love the analysis above which everyone has been asking for. As you say, the tax is negligible and a fair trade-off for eliminating CRT redist woes for the end developer. That said, the competition for this is the VCLibs.UWPDesktop converged framework package and dynamic dependency deployment (yes?). Should pros/cons of that option be considered and included? |
No. They're not really equivalent if you consider process startup and loader dependencies. VCLibs framework package is cool for packaged processes as they're born with the manifested dependency in their loader search order. Not so for unpackaged apps. For non-C/C++ modules it's no big deal since they have no imports to the CRT so e.g. C# foo.exe can run, use DynDep to load VCLibs.UWPDesktop than use CRT APIs. For C/C++ (and Rust? Others?) modules they'd with any IAT entries for the CRT would have to delayload the CRT. Possible but irksome so the added friction is unappealing. The small tax for this hybrid approach is a more compelling answer, at least for Project Reunion. |
Pull request was closed
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
I'm copying this, for a few places we were thinking of using static C runtime. I want vcredist to be easier to use and then always dynamically link. The main but not only places in question are MSI custom actions. Alternatively, run vcredist early, then reboot, then continue. |
Why no security issue? Non-ucrt C runtime never has security bugs? Or because xcopy deploy and/or static linking is so prevalent? I really wish for a better dynamic linking and setup story for Windows, but clearly it is not happening. :( |
Update Microsoft.ProjectReunion.dll, Microsoft.ProjectReunion.Bootstrap.dll, DynamicDependency DataStore and LifetimeManager to use the Universal CRT (like MRTCore's been doing) and VS' static CRT. This removes the dependency on the VS CRT redistributable at negible cost (see below).
Static analysis before/after using
LINK /DUMP /IMPORTS
, linker options/MAP /VERBOSE
andSizeBench
confirms the trivial size delta.Disk size of x64 Binaries
SizeBench delta for Microsoft.ProjectReunion.dll
SizeBench delta for Microsoft.ProjectReunion.Bootstrap.dll
The
.vcxproj
changes are based the implementation inMRM.vcxproj
andBaseUnitTests.vcxproj
Snippets below:
#1 UseUnicrt
#2-4 ClCompile and Link options
This really should go into a common
UniversalCrt.props
like other common properties (no reason all projects shouldn't use this) along with stripping unwanted options and/or verifying no inconsistencies but those build infrastructure refinements are left as an exercise for a future PR. First step is to use UCRT for product.