升级到通用 CRT - 如何摆脱对 vcruntime140.dll 和 msvcp140.dll 的依赖?
Upgrading to Universal CRT-how can I get rid of a dependency on vcruntime140.dll and msvcp140.dll?
我有一个项目正在尝试更新到通用 CRT,但我仍然看到对 vcruntime140.dll 和 msvcp140.dll 的依赖,我认为它们应该被替换带有 ucrtbase.dll,以及 api-ms-win-crt* dll。
我已经查看了这个回复 , and this blog post,它很好地解释了事情,但仍然没有运气。这是我所做的更改:
- 平台工具集:Visual Studio 2019 (v142)
- WindowsSDK版本:10.0(最新安装版本)
- 其他包含目录:添加了 $(UniversalCRT_IncludePath)
- 额外的库目录:添加了$(UniversalCRT_LibraryPath_x86)
我还更新了我的链接器依赖项到这个集合:
- ucrt.lib
- vcruntime.lib
- msvcrt.lib
- user32.lib
- advapi32.lib
- Wsock32.lib
- Crypt32.lib
- ws2_32.lib
但是当我运行dumpbin/家属mydll.dll
File Type: DLL
Image has the following dependencies:
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
VCRUNTIME140.dll
USER32.dll
ADVAPI32.dll
WSOCK32.dll
CRYPT32.dll
WS2_32.dll
MSVCP140.dll
bcrypt.dll
KERNEL32.dll
Summary
E000 .data
66000 .rdata
E000 .reloc
1000 .rsrc
14A000 .text
我还缺少其他东西来摆脱对特定 CRT 版本的依赖吗?
我做了更多的挖掘,发现 this page 说了以下内容:
Starting in Visual Studio 2015, the CRT has been refactored into new
binaries. The Universal CRT (UCRT) contains the functions and globals
exported by the standard C99 CRT library. The UCRT is now a Windows
component, and ships as part of Windows 10.
太好了,这正是我所期望的。下面是这个:
The vcruntime library contains Visual C++ CRT implementation-specific
code, such as exception handling and debugging support, runtime checks
and type information, implementation details and certain extended
library functions. This library is specific to the version of the
compiler used.
这意味着仍然有一个非通用的 VC++ 依赖项被 VS 链接进来。对我来说,这意味着无依赖性 DLL 并不真正存在(至少不存在使用 VC++ 构建的东西),因为您将始终具有 vcruntime 依赖性。
总是有静态链接 (/MT) 的选项,但就我而言,我也在查看具有 /clr 的 DLL,这两个选项是互斥的。应用程序本地部署(只需使用二进制文件复制 vcruntime140.dll)似乎也可以工作,并且可能是我希望成为 portable/xcopy 部署的最佳选择。
我暂时将此标记为答案,但如果有解决方法,我很想看看。
我有一个项目正在尝试更新到通用 CRT,但我仍然看到对 vcruntime140.dll 和 msvcp140.dll 的依赖,我认为它们应该被替换带有 ucrtbase.dll,以及 api-ms-win-crt* dll。
我已经查看了这个回复
- 平台工具集:Visual Studio 2019 (v142)
- WindowsSDK版本:10.0(最新安装版本)
- 其他包含目录:添加了 $(UniversalCRT_IncludePath)
- 额外的库目录:添加了$(UniversalCRT_LibraryPath_x86)
我还更新了我的链接器依赖项到这个集合:
- ucrt.lib
- vcruntime.lib
- msvcrt.lib
- user32.lib
- advapi32.lib
- Wsock32.lib
- Crypt32.lib
- ws2_32.lib
但是当我运行dumpbin/家属mydll.dll
File Type: DLL
Image has the following dependencies:
api-ms-win-crt-string-l1-1-0.dll api-ms-win-crt-heap-l1-1-0.dll api-ms-win-crt-runtime-l1-1-0.dll api-ms-win-crt-stdio-l1-1-0.dll api-ms-win-crt-filesystem-l1-1-0.dll api-ms-win-crt-convert-l1-1-0.dll api-ms-win-crt-time-l1-1-0.dll api-ms-win-crt-environment-l1-1-0.dll api-ms-win-crt-utility-l1-1-0.dll VCRUNTIME140.dll USER32.dll ADVAPI32.dll WSOCK32.dll CRYPT32.dll WS2_32.dll MSVCP140.dll bcrypt.dll KERNEL32.dll
Summary
E000 .data 66000 .rdata E000 .reloc 1000 .rsrc 14A000 .text
我还缺少其他东西来摆脱对特定 CRT 版本的依赖吗?
我做了更多的挖掘,发现 this page 说了以下内容:
Starting in Visual Studio 2015, the CRT has been refactored into new binaries. The Universal CRT (UCRT) contains the functions and globals exported by the standard C99 CRT library. The UCRT is now a Windows component, and ships as part of Windows 10.
太好了,这正是我所期望的。下面是这个:
The vcruntime library contains Visual C++ CRT implementation-specific code, such as exception handling and debugging support, runtime checks and type information, implementation details and certain extended library functions. This library is specific to the version of the compiler used.
这意味着仍然有一个非通用的 VC++ 依赖项被 VS 链接进来。对我来说,这意味着无依赖性 DLL 并不真正存在(至少不存在使用 VC++ 构建的东西),因为您将始终具有 vcruntime 依赖性。
总是有静态链接 (/MT) 的选项,但就我而言,我也在查看具有 /clr 的 DLL,这两个选项是互斥的。应用程序本地部署(只需使用二进制文件复制 vcruntime140.dll)似乎也可以工作,并且可能是我希望成为 portable/xcopy 部署的最佳选择。
我暂时将此标记为答案,但如果有解决方法,我很想看看。