visual-c++ - 如何在 VC++ 10.0 中链接 msvcrt.dll 而不是 msvcr100.dll?

标签 visual-c++

是否可以在 VC++10.0 中链接 VC6 的 MSVCRT.DLL?

默认情况下,它似乎与 MSVCR100.DLL 链接,但我不想重新分发另一个 DLL(MSVCRT.DLL 已在我支持的每个操作系统中可用)。

==编辑==

澄清一下:我的应用程序是一个进行 WinAPI 调用的纯 C 应用程序。我确实理解执行 C++ 将需要 C++ 运行时,默认情况下它没有捆绑在 Windows 中(并且很可能无论如何都必须匹配编译器)。我的问题是关于纯 C 的使用,并且只有我所针对的最早版本的 Windows 中存在的 CRT 函数。

最佳答案

这不是 VC6 运行时。它是 MSVCRT.DLL 的系统副本,与 Windows 而不是 Visual Studio 捆绑在一起。每个新版本的 Windows 都会获得一个新版本的 MSVCRT.DLL,您可以通过检查文件大小看到。

您可以使用 Windows 驱动程序工具包针对 MSVCRT.DLL 的系统副本进行编译。请注意,此 DLL 仅供“系统级组件”使用。什么是系统级组件?嗯,司机。或者,例如,文本服务:

http://blogs.msdn.com/b/tsfaware/archive/2008/01/17/visual-studio-2008-issues.aspx

If you're building a text service DLL ... I would recommend installing the Vista (or XP) DDK and use the DDKWizard instead. The DDK comes with its own C/C++ compiler that uses the C Runtime Library that ships with the OS (and won't cause problems with other applications) ...



更多信息:

http://kobyk.wordpress.com/2007/07/20/dynamically-linking-with-msvcrtdll-using-visual-c-2005/

A question arises, what does Microsoft do? They deploy their applications to a variety of Windows environments. A look at Windbg’s dependencies showed it’s using MSVCRT.DLL rather than one of the newer CRTs. Microsoft’s new Network Monitor 3.1 also uses MSVCRT.DLL. Windows Desktop Search is also using the old, trusty CRT.

How can all these new applications be using the vintage CRT? They’re not still using the antique, unsupported Visual C++ 6.0, are they? Well, no. The answer is more complicated and can be found in the Windows Driver Kit (WDK).



更新:Windows 8 Driver Kit 引入了一个新的基于 MSBuild 的构建系统,它不再链接到 MSVCRT.DLL 的系统副本。但是,使用 Windows 7 Driver Kit 构建的二进制文件仍然适用于 Windows 8 和 Windows 10。

MSVCRT.DLL 仍随 Windows 10 提供以实现向后兼容性,因此它带有 7.0.##### 的文件版本。一个仍在积极开发中的组件,例如user32.dll,其文件版本为10.0.#####。

关于visual-c++ - 如何在 VC++ 10.0 中链接 msvcrt.dll 而不是 msvcr100.dll?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10166412/

相关文章:

c++ - 通过if else在函数中定义变量

c++ - 如何将整个 Visual c++ 项目加载到 Enterprise Architect 中以对其进行逆向工程?

c++ - 正则表达式 Visual Studio

c++ - 在 Clang 中使用 MSVC 预处理器 'charizing' 运算符

c++ - 如何使用模板参数包实现仅限几种类型的SFINAE

visual-c++ - 在 mingw 中使用 msvc lib

c++ - C++ 编译器如何合并相同的字符串文字

visual-studio - 容器和自定义目录中的 Visual C++ Build Tools 2015

c++ - 如何在托管 C++ 中正确实现返回 "this"的类的方法?

c++ - 使用 MSVC 2013 初始化 `static constexpr double`