Visual Studio 2008,运行时库使用建议
我想要一些有关 Visual Studio 2008 运行时库的信息。最具体地说,什么时候应该考虑 DLL 版本以及什么时候应该考虑静态版本。
Visual Studio 文档描述了 DLL 依赖项和链接库方面的技术差异。 但我想知道为什么我应该使用其中一个而不是另一个。 更重要的是,为什么我要使用多线程 DLL 运行时,因为这显然会迫使我的应用程序产生 DLL 依赖关系,而静态运行时在我的应用程序用户计算机上没有这样的要求。
I would like some information on the runtime libraries for Visual Studio 2008. Most specifically when should I consider the DLL versions and when should I consider the Static versions.
The Visual Studio documentation delineates the technical differences in terms of DLL dependencies and linked libraries. But I'm left wondering why I should want to use one over the other. More important, why should I want to use the multi-threaded DLL runtime when this obviously forces my application into a DLL dependency, whereas the static runtime has no such requirement on my application user machine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
由于 DLL 依赖性,动态链接到运行时库会使部署稍微复杂化,但也允许您的应用程序利用 MS 运行时库的更新(错误修复或更可能的性能改进),而无需重新编译。
静态链接简化了部署,但意味着您的应用程序必须针对较新版本的运行时重新编译才能使用它们。
Linking dynamically to the runtime libraries complicates deployment slightly due to the DLL dependency, but also allows your application to take advantage of updates (bug fixes or more likely performance improvements) to the MS runtime libraries without being recompiled.
Statically linking simplifies deployment, but means that your application must be recompiled against newer versions of the runtime in order to use them.
Larry Osterman 认为您应该始终使用多线程 DLL< /a> 用于应用程序编程。 总结一下:
请阅读他的 整个博客文章了解完整详细信息。
不利的一面是,您需要 重新分发运行时库,但这很常见,您可以找到有关如何将其包含在安装程序中的文档。
Larry Osterman feels that you should always use the multi-threaded DLL for application programming. To summarize:
Please read his whole blog post for full details.
On the downside, you need to redistribute the runtime library, but that's commonly done and you can find documentation on how to include it in your installer.
动态链接运行时库可以为您提供更快的程序启动时间和更小的系统内存使用量,因为 dll 可以在进程之间共享,并且如果它已被另一个进程使用,则不需要再次加载。
Dynamically linking the runtime library can give you faster program start up times and smaller system memory usage since the dll can be shared between processes and won't need to be loaded again if it's already used by another process.
我认为主要区别在于如何处理异常。 Microsoft 不建议静态链接到 DLL 中的 CRT,除非特别需要并理解这样做的后果:
I think that main difference is how exceptions will be processed. Microsoft doesn't recommend to link statically to the CRT in a DLL unless the consequences of this are specifically desired and understood: