Big problem with Small programs

Walter Bright newshound at digitalmars.com
Tue Jan 23 03:27:27 PST 2007


kris wrote:
> I have a helloworld.d program. I compile it on both Win32 and on linux. 
> On linux, the executable is 72KB whereas on Win32 it is 141KB. Why is this?
> 
> Turns out that D programs importing comprehensive Win32 D headers will 
> wind up with executable space occupied for *all* constants and *all* 
> struct initializers for the darned Win32 decls; where none of them are 
> actually used.
> 
> That amounts to ~70KB of junk in the executable -- almost a full 100% 
> increase in size beyond what it should be.
> 
> Does OptLink remove this? I've had no success with it. Walter? Can you 
> help with this?
> 
> - Kris

Try using enums instead of const variables, they don't take up any space 
in the object file.



More information about the Digitalmars-d mailing list