tags:

views:

282

answers:

2

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?

+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
+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
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