Executable size affected by module count?

kris foo at bar.com
Wed Jan 24 12:59:19 PST 2007


Given a (fixed) body of code, it appears that retaining it all within 
one module, and splitting it into multiple modules, results in different 
executable sizes?

There's no real surprise that this would happen, but it's the actual 
difference that is cause for a little concern -- it appears that each 
module consumes 512 bytes minimum. This may actually be a linker thing, 
but perhaps not?

Why would this matter? Well, if you wind up using the 158 modules in the 
  Win32 project, that adds nearly 80KB to an application. Purely in 
module overhead. And, those headers are almost all enum, const, and struct.

This is in addition to the ~70KB of unused initializer from the Win32 
headers, dicussed in the other topic. That's a whole lot of overhead for 
Win32 programs to carry -- especially if the target is mobile devices.

Obviously, you'd be doing something truly serious if you were actually 
using all those header modules! However, Win32 headers are not exactly a 
model in decoupled design (in C also), so you wind up with large numbers 
of them unintentionally.

Any ideas, Walter?



More information about the Digitalmars-d mailing list