Big executable?

Justin Johansson 3.1415926536 at bingmail.com
Thu Oct 7 05:42:50 PDT 2010


On 6/10/2010 5:12 PM, Andre Tampubolon wrote:
> Hi,
>
> I just started learning D (my background is C, anyway).
>
> I compiled this simple code using DMD 2.049 (dmd -O -release test1.d) :
> import std.stdio;
>
> void main()
> {
> writefln("%s World", "Hello");
> }
>
> The final executable size is about 300 KB. Isn't that a bit huge,
> considering the same code compiled using C or Pascal compiler will give
> smaller executable? So I tried to look at the *.map, and apparently the
> D runtime pulls a lot of stuff. I am just wondering, anyway.

Try assembly language.  Your executable will be less than 256 bytes
(perhaps on legacy operating systems, and, of course, using the
O/S to make a call to write to stdout).

Naturally YMMV depending on the language translator that you use,
and, as you have appropriately noted, your mileage experience is
not climate-change friendly.

-- Justin


More information about the Digitalmars-d mailing list