www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - How to reduce executable size

reply Anonymous <Anonymous_member pathlink.com> writes:
Hi there,

Even the simplest D program "void main(){}" is compiled into 80+
kilobytes by dmd (win32) in release mode.
Is there some way to reduce the code size?

Thanks in advance.
Jan 21 2005
next sibling parent "huang yicheng" <zergbird msn.com> writes:
maybe use some tools like upx?:)

Yicheng
"Anonymous" <Anonymous_member pathlink.com> wrote in message
news:csraoo$9q9$1 digitaldaemon.com...
 Hi there,

 Even the simplest D program "void main(){}" is compiled into 80+
 kilobytes by dmd (win32) in release mode.
 Is there some way to reduce the code size?

 Thanks in advance.

Jan 21 2005
prev sibling next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Anonymous wrote:

 Even the simplest D program "void main(){}" is compiled into 80+
 kilobytes by dmd (win32) in release mode.
 Is there some way to reduce the code size?

The main reason a C++ program is smaller is that it uses a dynamic run-time library. D uses a static "phobos" library. If C++ is compiled with a static runtime as well, I find the executables it generates to be a lot larger than the D ones ? But C is still a lot smaller. Not that 80 KB is anything... --anders PS. Here are my sizes:
  12K    hello_c
 368K    hello_cpp
 100K    hello_d
 4.0K    hello.jar

For "Hello, World!"...
Jan 21 2005
prev sibling parent Kris <Kris_member pathlink.com> writes:
In article <csraoo$9q9$1 digitaldaemon.com>, Anonymous says...
Hi there,

Even the simplest D program "void main(){}" is compiled into 80+
kilobytes by dmd (win32) in release mode.
Is there some way to reduce the code size?

Thanks in advance.

Yes; convince Walter to remove printf() from Object.d ... it drags along all the floating point library support, just for jollies.
Jan 21 2005