enormous executable

Willem Robert van Hage wrvh@xs4all.nl
Sat, 29 Sep 2001 12:58:12 +0200

> > -rwxr-xr-x    1 willem   users      201453 Sep 29 09:55 hello
> > -rw-r--r--    1 willem   users          51 Sep 29 09:54 hello.hs
> > -rw-r--r--    1 willem   users        1468 Sep 29 09:55 hello.o
> Probably, the executable  hello  is 1000 times larger than object
> one because some piece of  library (including binary code for 
> outputting a string) is linked to it.
> In small user programs the library code is usually the larger 
> part. In large user programs, it will be the smaller part.
> Serge Mechveliani

I think so too, but what I'm surprised about is that GHC apparently
can't use printing functions and all those other things I saw in
`strings hello`, for example things about sockets, forks and file IO,
from a library instead of compiling it into the 'hello' binary.
In the case of a 200k hello world file that isn't a big problem,
but I want to do things with the gtk+hs toolkit and I've noticed that
even the simplest programs take up 2Mb. 'strings' on an executable
that uses gtk+hs show an endless list of unused functions.
Things like functions for radiobuttons while the only thing I use is
a label, a box and a window. I find that kind of strange.
I'm using GHC on a laptop with not a very big harddisk.

Doesn't GHC first check which functions actually get used and then
only link those to the binary?

Willem van Hage

wrvh@xs4all.nl         | http://www.xs4all.nl/~wrvh
wrvhage@science.uva.nl | http://quest.sourceforge.net