[wxMSW]: why EXE-files are so large?

24 views
Skip to first unread message

K.Tomaszewski

unread,
Jan 2, 2002, 2:56:02 AM1/2/02
to wx-u...@lists.wxwindows.org
Hi, I'm new with wxWindows. Earlier I was using OWL 5.0 (with Borland C++
5.00 compiler) and my EXE-files had size about 100KB. My largest executable
file compiled from program with OWL was about 350KB. Now I want to start
using wxWindows instead of OWL, but EXE-file produced from "minimal" example
project is about 1.2MB (release version).
I'm using Borland C++ 5.5 compiler from C++ Builder 5 (even VCL minimal
aplication has size less then 400KB).
I'd like to stay with wxWindows, but size of programs compiled with it is
quite big disadvantage for me. Is there someone who know, how to compile
smaller executables?
I've compiled wxWindows, and my wxWindows main LIB-file is about 5MB
(release).

Krzysztof Tomaszewski, Poland

p.s.
Please, help me - I don't want to use Borland libraries (OWL, VCL, who knows
what more...) no more!!! ;-)


George Tasker

unread,
Jan 2, 2002, 3:14:01 AM1/2/02
to wx-u...@lists.wxwindows.org
"K.Tomaszewski" wrote:

> Hi, I'm new with wxWindows. Earlier I was using OWL 5.0 (with Borland C++
> 5.00 compiler) and my EXE-files had size about 100KB. My largest executable
> file compiled from program with OWL was about 350KB. Now I want to start
> using wxWindows instead of OWL, but EXE-file produced from "minimal" example
> project is about 1.2MB (release version).

Not having used OWL, Imay be offbase, but I believe there are DLLs you must
distribute with your app as well if you distribute it. You could compile
wxWindows as a DLL and that would drastically shrink the size of the EXE itself.

g


Manley, Monty R.

unread,
Jan 2, 2002, 3:17:02 AM1/2/02
to wx-u...@lists.wxwindows.org
You probably are using static linking rather than dynamic, which means that
your EXE has wxWindows statically linked in. Build wxWindows as a DLL and
use it with the WXUSINGDLL=1 flag when you make.

Regards,

Monty Manley

> -----Original Message-----
> From: K.Tomaszewski [mailto:atomo...@o2.pl]
> Sent: Wednesday, January 02, 2002 9:57 AM
> To: wx-u...@lists.wxwindows.org
> Subject: [wxMSW]: why EXE-files are so large?
>
>
> Hi, I'm new with wxWindows. Earlier I was using OWL 5.0 (with
> Borland C++
> 5.00 compiler) and my EXE-files had size about 100KB. My
> largest executable
> file compiled from program with OWL was about 350KB. Now I
> want to start
> using wxWindows instead of OWL, but EXE-file produced from
> "minimal" example
> project is about 1.2MB (release version).

> I'm using Borland C++ 5.5 compiler from C++ Builder 5 (even
> VCL minimal
> aplication has size less then 400KB).
> I'd like to stay with wxWindows, but size of programs
> compiled with it is
> quite big disadvantage for me. Is there someone who know, how
> to compile
> smaller executables?
> I've compiled wxWindows, and my wxWindows main LIB-file is about 5MB
> (release).
>
> Krzysztof Tomaszewski, Poland
>
> p.s.
> Please, help me - I don't want to use Borland libraries (OWL,
> VCL, who knows
> what more...) no more!!! ;-)
>
>

> _______________________________________________
> wx-users mailing list
> wx-u...@lists.wxwindows.org
> http://lists.wxwindows.org/mailman/listinfo/wx-users
>

Julian Smart

unread,
Jan 2, 2002, 3:28:06 AM1/2/02
to wx-u...@lists.wxwindows.org
Make sure you don't have any debug info enabled, and are using optimization for size.

VC++ is probably the bester optimizing compiler and can generate relatively small binaries.

You can also switch features off in include/wx/msw/setup0.h, which may help reduce size.

And finally you can cheat and use upx.exe which will reduce the exe size by maybe 50%. My local copy of Tex2RTF is statically linked with VC++ and upx'ed, ending up at a meagre 268,288 bytes.

Regards,

Julian

At 05:23 PM 1/2/02 +0100, you wrote:
>Hi, thanks for answer.
>But, you see, I'd like to generaly decrease the size of EXE-file. When I'll
>do as you said I will have to distibute 2 files: EXE-file and DLL-file (when
>we're talking about Win platform, but I hope that with wxWindows I'll be
>able to compile my single code for Unix, Linux, etc - there is no DLL's),
>and I think (nearly sure) that their size (both) will be even larger than
>size of standalone EXE-file.
>
>Krzysiek


>
>>
>> Not having used OWL, Imay be offbase, but I believe there are DLLs you
>must
>> distribute with your app as well if you distribute it. You could compile
>> wxWindows as a DLL and that would drastically shrink the size of the EXE
>itself.
>>
>> g
>
>
>

>_______________________________________________
>wx-users mailing list
>wx-u...@lists.wxwindows.org
>http://lists.wxwindows.org/mailman/listinfo/wx-users

--
Red Hat UK Ltd, Unit 200 Rustat House, 62 Clifton Road, Cambridge, UK. CB1 7EG Tel: +44 (1223) 271063

K.Tomaszewski

unread,
Jan 2, 2002, 3:23:02 AM1/2/02
to wx-u...@lists.wxwindows.org
Hi, thanks for answer.
But, you see, I'd like to generaly decrease the size of EXE-file. When I'll
do as you said I will have to distibute 2 files: EXE-file and DLL-file (when
we're talking about Win platform, but I hope that with wxWindows I'll be
able to compile my single code for Unix, Linux, etc - there is no DLL's),
and I think (nearly sure) that their size (both) will be even larger than
size of standalone EXE-file.

Krzysiek

>

K.Tomaszewski

unread,
Jan 2, 2002, 3:28:02 AM1/2/02
to wx-u...@lists.wxwindows.org
YES!!! Exactly, and I know that. You see - simplest Borland C++Builder5.0
(VCL library) aplication compliled pure statically has size about 350KB - it
uses no Builder's DLL-files. I want the same - static EXE file which is
using no DLL files and has size less than 500KB.
But now I have about 1200KB! Maybe it's because of compiler (borland C++
5.5.1 compiler)?

Krzysiek

Manley, Monty R.

unread,
Jan 2, 2002, 3:29:01 AM1/2/02
to wx-u...@lists.wxwindows.org
If you want to statically link *and* keep the size of your EXE down, your
options are kind of limited: wxWindows has a lot of dependencies, which
means a lot of stuff is going to be linked in. However, you can try to
manage your header files a bit better.

For example, rather than doing this at the head of every .cpp file:

#include <wx/wx.h>

Try this:

#include <wx/wxwindow.h>
#include <wx/wxbutton.h>

... and so on. In this way you can use only the items you need and not link
in unnecessary objects. You'll still have a pretty big EXE no matter what,
though: I modified the MINIMAL project to try this out and my EXE still came
to over 800K on Windows using the Borland compiler. (I probably could have
trimmed some stuff, though.) If you think about it, 800K isn't that
unreasonable for the amount of stuff there.

Regards,

Monty

> -----Original Message-----
> From: K.Tomaszewski [mailto:atomo...@o2.pl]

George Tasker

unread,
Jan 2, 2002, 3:36:02 AM1/2/02
to wx-u...@lists.wxwindows.org
Julian Smart wrote:

> And finally you can cheat and use upx.exe which will reduce the exe size by maybe 50%. My local copy of Tex2RTF is statically linked with VC++ and upx'ed, ending up at a meagre 268,288 bytes.

UPX makes many Borland compiled programs crash on startup (first hand experience speaking here). I have tried the latest UPX and all various settings for what to compress and what not to
compress. The key to the problem is probably (hopefully) there, but I never found it. I haven't tried it on wxWindows RELEASE build samples though....

The best compression I have gotten on our Borland compiled EXEs was about 29%.

g


Giorgio Galante

unread,
Jan 2, 2002, 8:14:02 AM1/2/02
to wx-u...@lists.wxwindows.org
Check out CExe at http://www.eskimo.com/~scottlu/win/index.html

It's free, open-source, blah blah...the long and the short of it is, the
1.0mb bombs.exe (wxwin\demos\bombs) is compressed to 400k. Not bad as
far as I'm concerned.

-----Original Message-----
From: wx-user...@lists.wxwindows.org
[mailto:wx-user...@lists.wxwindows.org] On Behalf Of George Tasker
Sent: Wednesday, January 02, 2002 11:14 AM
To: wx-u...@lists.wxwindows.org
Subject: Re: [wxMSW]: why EXE-files are so large?

"K.Tomaszewski" wrote:

g


chris elliott

unread,
Jan 2, 2002, 8:46:01 AM1/2/02
to wx-u...@lists.wxwindows.org, atomo...@o2.pl
The Borland built DLL is certainly bigger than an exe; the linker seems to
leav in lots of code which isn't really necessary. If you can find a copy of
borland 5.0 or cbuilder 1 you will produce a bit smaller exes for the same
wxwin library. The dll is a real advntage when you have several apps with
the same dll :-(
chris

----- Original Message -----
From: "K.Tomaszewski" <atomo...@o2.pl>
To: <wx-u...@lists.wxwindows.org>
Sent: Wednesday, January 02, 2002 4:23 PM
Subject: Re: [wxMSW]: why EXE-files are so large?

Vaclav Slavik

unread,
Jan 2, 2002, 10:21:02 AM1/2/02
to wx-u...@lists.wxwindows.org
Hi,

Manley, Monty R. wrote:
> For example, rather than doing this at the head of every .cpp file:
>
> #include <wx/wx.h>
>
> Try this:
>
> #include <wx/wxwindow.h>
> #include <wx/wxbutton.h>

Are you sure this actually helps? If yes, then Borland C++ is
*really* weird compiler. I can't believe this...

Instead, you can disable features you don't want in setup.h -- just
set wxUSE_xxx defines to 0 for unused stuff. That's about the only
way how to reduce static binary's size.

HTH,
Vaclav


Reply all
Reply to author
Forward
0 new messages