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

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

问题描述

多年来,我的应用程序已经从1MB增长到25MB,我预计它将进一步增长到40,50 MB。我不使用DLL,但把所有东西放在这个大的可执行文件中。



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




  • 在客户端安装我的应用程序真的是:复制并运行。

  • 升级可以轻松地压缩并发送给客户

  • 不存在冲突的DLL的风险(客户具有EXE的版本X,但是DLL的版本Y)



大EXE的最大缺点是连接时间似乎呈指数级增长。



其他问题是代码的一部分(我们说约40 %)与其他应用程序共享。再次,它的优点是:




  • 没有组合不正确的DLL版本的风险

  • 每个开发人员可以对通用代码进行更改,从而加快开发速度。



但是,这又对编译次数(每个人都在PC上重新编写通用代码)和链接时间。



问题将DLL用于可执行文件提到将DLL混合在一个可执行文件中的可能性,但是它仍然需要您在应用程序中手动链接所有功能(使用LoadLibrary,GetProcAddress,...)。



您对可执行文件大小的意见是什么,DLL的使用以及轻松部署之间的最佳平衡开发?

解决方案

单个可执行文件对主要的续性。调试,部署(将问题放在一边)并在现场进行诊断变得更加容易。正如你所指出的,它完全回避DLL地狱。



最简单的解决方案是你的问题是有两种编译模式,一种构建一个单独的exe进行生产,一个它构建了很多小的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:

  • Installing my application at the customer is really: copy and run.
  • Upgrades can be easily zipped and sent to the customer
  • There is no risk of having conflicting DLL's (where the customer has version X of the EXE, but version Y of the DLL)

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

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

  • There is no risk on having a mix of incorrect DLL versions
  • Every developer can make changes on the common code which speeds up developments.

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

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, ...).

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

解决方案

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.

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天全站免登陆