简体   繁体   中英

Delphi: .exe with built-in packages: 600kb, .exe + external BPLs: 6MB. Why is that?

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM