Delphi:带有内置软件包的.exe:600kb,.exe +外部 BPL:6MB。这是为什么?

发布于 2024-08-03 03:47:43 字数 123 浏览 4 评论 0原文

如果我用内置包在delphi中编译.exe文件,它会生成大约600kb的EXE文件。但是,如果我使用运行时包对其进行编译,则大小总和(.exe + 所有必需的 .BPL)约为 6-8 MB(取决于编译器的版本)。为什么差异如此显着?

if I compile .exe file in delphi with built-in packages, it generates about 600kb EXE file. However if I compile it with runtime packages, the sum of sizes (.exe + all required .BPLs) is about 6-8 MB (depending on version of compiler). Why is the difference so significant?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

多像笑话 2024-08-10 03:47:43

因为如果您运行正常编译,链接器可以在 DCU 上进行“智能链接”并删除您的程序永远不需要的代码。但这些包是预先构建的,并且包含所有代码,因此您无法将它们智能链接到更小的大小。

Because if you run a normal compile, the linker can do "smart linking" on the DCUs and remove code that your program never needs. But the packages are prebuilt and have all the code included, so you can't smartlink them down to a smaller size.

所谓喜欢 2024-08-10 03:47:43

我认为您假设在生成带有内置 BPL 的程序时链接了整个 BPL 文件。事实并非如此。在编译的最后阶段,Delphi 编译器将所有内容链接在一起。在那里,它省略了 BPL 中但不被程序直接或间接调用的模块。

因此,最终的占用空间要小得多,只有实际需要的模块位于最终的 exe 中。

I think you assume the whole of the BPL files are linked in when you generate a program with built-in BPL's. That is not the case. In the final stage of compilation, the Delphi compiler goes into linking everything together. There it omits the modules, that are in the BPL's but not called directly or indirectly by your program.

So, you end up with a much smaller footprint, only the modules actually needed are in the final exe.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文