如何在 VC++ 10.0 中链接 msvcrt.dll 而不是 msvcr100.dll? [英] How to link against msvcrt.dll instead of msvcr100.dll in VC++ 10.0?

查看:45
本文介绍了如何在 VC++ 10.0 中链接 msvcrt.dll 而不是 msvcr100.dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Is it possible to link against VC6's MSVCRT.DLL in VC++10.0?

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

By default it seems to be linking with MSVCR100.DLL, but I don't want to redistribute yet another DLL (MSVCRT.DLL is already available in every OS that I support).

==编辑==

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

To clarify: my application is a pure C application that makes WinAPI calls. I do understand that doing C++ will require the C++ runtime, which is not bundled in Windows by default (and most probably has to match the compiler anyway). My question is about pure C usage, and only the CRT functions that exist in the earliest version of Windows that I'm targeting.

推荐答案

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

It's not the VC6 runtime. It's a system copy of MSVCRT.DLL that's bundled with Windows rather than Visual Studio. Each new version of Windows gets a new version of MSVCRT.DLL, as you can see by checking the file sizes.

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

You can compile against the system copy of MSVCRT.DLL by using the Windows Driver Kit. Note that this DLL is for use "only by system-level components." What's a system-level component? Well, a driver. Or, for example, a text service:

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

如果您正在构建文本服务 DLL ...我建议安装Vista(或 XP)DDK 并改用 DDKWizard.DDK来了使用自己的 C/C++ 编译器,使用随附的 C 运行时库与操作系统(并且不会导致其他应用程序出现问题)...

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/

问题来了,微软是做什么的?他们部署他们的适用于各种 Windows 环境的应用程序.看看 Windbg 的依赖项显示它使用的是 MSVCRT.DLL 而不是较新的CRT.Microsoft 的新网络监视器 3.1 也使用 MSVCRT.DLL.Windows 桌面搜索也在使用旧的、值得信赖的 CRT.

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.

所有这些新应用程序如何使用老式 CRT?他们是不再使用古老的、不受支持的 Visual C++ 6.0,是吗?嗯,不.答案比较复杂,可以在Windows 驱动程序工具包 (WDK).

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 驱动程序工具包引入了一个新的基于 MSBuild 的构建系统,它不再链接到 MSVCRT.DLL 的系统副本.但是,使用 Windows 7 Driver Kit 构建的二进制文件仍然适用于 Windows 8 和 Windows 10.

Update: The Windows 8 Driver Kit introduced a new MSBuild-based build system, which no longer links against the system copy of MSVCRT.DLL. However, binaries built with the Windows 7 Driver Kit still work on Windows 8 and Windows 10.

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

MSVCRT.DLL is still shipped with Windows 10 for backward compatibility, so it carries a File version of 7.0.#####. A component that is still being actively developed, such as user32.dll, carries a File version of 10.0.#####.

这篇关于如何在 VC++ 10.0 中链接 msvcrt.dll 而不是 msvcr100.dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆