why simple hello world binary is ~700KB

Sean Kelly sean at f4.ca
Thu Oct 4 15:30:45 PDT 2007


Gregor Richards wrote:
> Sean Kelly wrote:
>> Bedros Hanounik wrote:
>>> Ok, I tried dmd 2.0 with the same code and got 271KB binary out of 
>>> it. still huge compared to 6.5KB generated by gcc.
>>
>> About the smallest "hello world" binary you'll get from a recent 
>> version of D is 100k.  Prior to 1.0, it was possible to get a 70k 
>> "hello world" program.  In every case however, cstdlib is statically 
>> linked to the app.
> 
> Um, I hope you mean the /D/ stdlib? The C stdlib is never statically 
> linked.
> 
> In fact, glibc is incredibly resistant to being statically linked in any 
> scenario.

You're right.  I meant the D standard library.  But Phobos' use of 
fprintf creates quite a few glibc dependencies, be they dynamically or 
statically resolved.  I'll admit that Tango does use fprintf with DMD 
for coverage and profiling output as well--this is a dependency I've 
been a tad too lazy to eliminate :-p


Sean



More information about the Digitalmars-d mailing list