Bloat in Executable

Adam D. Ruppe destructionator at gmail.com
Thu Nov 16 03:58:38 UTC 2017


On Thursday, 16 November 2017 at 03:32:26 UTC, codephantom wrote:
> 23k executable if 32bit (i.e. -m32 )

It is the statically linked C library. Note that if you remove 
the call to printf, the size is slashed in half.

Windows traditionally didn't do a system-wide C lib, but rather 
the various compiler vendors would do their own. To keep this 
from being a big pain for the end user, static linking can be 
employed as it apparently is with Digital Mars.

> 112k executable if 64bit (i.e. -m64 )

I'm not 100% sure this is the same, but I suspect it probably is.

> .. on freebsd ..
> 5.6k executable if 32bit (i.e. -m32 )

If you ldd that, you'll see it dynamically links the C library. 
The downside of this is there's less binary compatibility across 
major versions; you are liable to need to recompile from source 
to deal with different libc versions on the system, whereas the 
Windows builds are more likely to just work.


More information about the Digitalmars-d mailing list