On 26 February 2012 21:28, Jabba Laci <jabba.l...@gmail.com> wrote: > Hi, > > I'm new to D. I tried the basic Hello World program ("dmd hello.d") > but it produced a 316 KB big binary. The same thing with C ("gcc > hello.c") is about 9 KB. Is there a way to reduce the size of the > produced binary? > > Thanks, > > Laszlo
Phobos (the standard library) is currently not a shared library, due to the fact that shared library support in D is poor at the moment, and D itself is relatively unstable, otherwise we would have 100's of versions of the library floating around... The C version is small because it uses the C library and runtime, which are dynamically linked, so aren't included in the size of the file. Try statically linking the C version, I can't remember exactly how to do that at the moment, and you'll find the sizes to be similar. Also compiling with -release and -O2 would reduce the size, but I'm not sure by how much.