一个大的可执行文件还是许多小的 DLL? [英] One big executable or many small DLL's?

查看:30
本文介绍了一个大的可执行文件还是许多小的 DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多年来,我的应用程序从 1MB 增长到 25MB,我预计它会进一步增长到 40、50 MB.我不使用 DLL,而是将所有内容都放在这个大的可执行文件中.

Over the years my application has grown from 1MB to 25MB and I expect it to grow further to 40, 50 MB. I don't use DLL's, but put everything in this one big executable.

拥有一个大的可执行文件有一定的优势:

Having one big executable has certain advantages:

  • 在客户处安装我的应用程序实际上是:复制并运行.
  • 升级可以轻松压缩并发送给客户
  • 不存在 DLL 冲突的风险(如果客户的 EXE 不是 X 版,而是 DLL 的 Y 版)

大 EXE 的最大缺点是链接时间似乎呈指数增长.

The big disadvantage of the big EXE is that linking times seem to grow exponentially.

另外一个问题是代码的一部分(假设大约 40%)与另一个应用程序共享.同样,优点是:

Additional problem is that a part of the code (let's say about 40%) is shared with another application. Again, the advantages are that:

  • 不存在混合不正确 DLL 版本的风险
  • 每个开发人员都可以对通用代码进行更改,从而加快开发速度.

但同样,这对编译时间(每个人都在他的 PC 上再次编译公共代码)和链接时间有严重影响.

But again, this has a serious impact on compilation times (everyone compiles the common code again on his PC) and on linking times.

问题将 DLL 分组以在可执行文件中使用 提到了混合的可能性DLL 位于一个可执行文件中,但看起来这仍然需要您手动链接应用程序中的所有函数(使用 LoadLibrary、GetProcAddress 等).

The question Grouping DLL's for use in Executable mentions the possibility of mixing DLL's in one executable, but it looks like this still requires you to link all functions manually in your application (using LoadLibrary, GetProcAddress, ...).

您对可执行文件的大小、DLL 的使用以及轻松部署和轻松/快速开发之间的最佳平衡"有何看法?

What is your opinion on executable sizes, the use of DLL's and the best 'balance' between easy deployment and easy/fast development?

推荐答案

单个可执行文件对可维护性具有巨大的积极影响.在现场更容易调试、部署(不考虑大小问题)和诊断.正如您所指出的,它完全避开了 DLL 地狱.

A single executable has a huge positive impact on maintainability. It is easier to debug, deploy (size issues aside) and diagnose in the field. As you point out, it completely sidesteps DLL hell.

解决您的问题最直接的方法是使用两种编译模式,一种为生产构建单个 exe,另一种为开发构建大量小 DLL.

The most straightforward solution to your problem is to have two compilation modes, one that builds a single exe for production and one that builds lots of little DLLs for development.

这篇关于一个大的可执行文件还是许多小的 DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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