Thread overview
a way to
Aug 04, 2005
eflick
Aug 04, 2005
zwang
Aug 04, 2005
zwang
Aug 04, 2005
Sean Kelly
Aug 07, 2005
SomeOne
Aug 04, 2005
Tim Laurent
Aug 04, 2005
pragma
Aug 04, 2005
John Demme
Aug 05, 2005
Geert
August 04, 2005
Is there anyway to make the compiled exe's smaller in size? They're huge compared to C++...

----------
August 04, 2005
eflick@gmail.com wrote:
> Is there anyway to make the compiled exe's smaller in size? They're huge
> compared to C++...
> 
> ----------

upx (with the --force option) may generally reduce the exe size by half.
August 04, 2005
zwang wrote:
> eflick@gmail.com wrote:
> 
>> Is there anyway to make the compiled exe's smaller in size? They're huge
>> compared to C++...
>>
>> ----------
> 
> 
> upx (with the --force option) may generally reduce the exe size by half.


If you're more ambitious, say you want to write the first 64k demo in D, I guess the first step is to hack a minimal Phobos.
August 04, 2005
eflick@gmail.com wrote:
> Is there anyway to make the compiled exe's smaller in size? They're huge
> compared to C++...

I'd also like to know why there are that big ... According to http://www.catch22.net/tuts/minexe.asp, a C program that _includes_ the C runtime is around 20 - 30 KB.

Is is neccessary to link a complete set of the D runtime into every executable, or can the linker only include the functions actually used?

Not that I cannot live with a 100 KB compressed D executable, but I've really no clue what consumes the space ...

-Tim

August 04, 2005
In article <dctbdp$cum$1@digitaldaemon.com>, eflick@gmail.com says...
>
>Is there anyway to make the compiled exe's smaller in size? They're huge compared to C++...
>
>----------

This has come up before.  No matter what, you're in for some light hacking to circumvent this problem.

Most of the bulk in the average D executable comes from the overall size of phobos.lib.  Since the source for phobos is included with D, it's not too tough to build your own.  Just pair down the set of included .d files to what you need and throw out the rest.

Also, there is an alternative to phobos that is currently under development: Ares.  Since its so new, it's far more lean than its cousin Phobos.

http://www.dsource.org/projects/ares

Now for the stuff that's hard to fix.

I think DMD also pulls in some C runtime .libs (under the dmc tree) that are pretty much unavoidable.  There may also be some linker options that will help reduce your program size as well.  Both of these issues may be pretty well documented here on digitalmars.com, and on usenet.

Also keep in mind that D *always* compiles in run-time type information; there's no way to turn it off as with most C++ compilers.

- EricAnderton at yahoo
August 04, 2005
Under linux, running it through "strip" reduces the size from 139k to 96k.  Not a whole lot, but it's a start.

On Thu, 2005-08-04 at 15:15 +0000, eflick@gmail.com wrote:
> Is there anyway to make the compiled exe's smaller in size? They're huge compared to C++...
> 
> ----------

August 04, 2005
In article <dctfcl$gh0$1@digitaldaemon.com>, zwang says...
>
>If you're more ambitious, say you want to write the first 64k demo in D, I guess the first step is to hack a minimal Phobos.

At the moment, that would be Ares.


Sean


August 05, 2005
John Demme wrote:
> Under linux, running it through "strip" reduces the size from 139k to
> 96k.  Not a whole lot, but it's a start.
> 
> On Thu, 2005-08-04 at 15:15 +0000, eflick@gmail.com wrote:
> 
>>Is there anyway to make the compiled exe's smaller in size? They're huge
>>compared to C++...
>>
>>----------
> 

Hehe, well it's nearly 31 percent of it's original size smaller, that's a whole lot for me.. ;)
August 07, 2005
In article <dctf42$ft7$2@digitaldaemon.com>, zwang says...

>eflick@gmail.com wrote:
>> Is there anyway to make the compiled exe's smaller in size? They're huge compared to C++...

>upx (with the --force option) may generally reduce the exe size by half.

I heard UPX has a nasty bug http://www.msoftware.co.nz/modules.php?op=modload&name=phpbb2&file=viewtopic.php&p=441&sid=4aaacc80660dcb0c0ef26caf19e2b2b5

Anyone knows if it has been fixed yet?