Hi, 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?
views:
282answers:
2
+13
A:
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.
Mason Wheeler
2009-08-21 14:05:21
+4
A:
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.
Rocky Luck
2009-08-21 14:18:34
Not just entire modules. The smartlinker can cut out individual functions and procedures from within a unit if it determines that they're never used.
Mason Wheeler
2009-08-21 14:19:46