Author Topic: Executable size  (Read 4806 times)

josemarin

  • Guest
Executable size
« on: November 18, 2005, 11:32:54 am »
Hello!


I've managed to compile and link my first wxWidgets program!

It's the minimal sample.

But the executable size is HUGE: 4MB!

I've changed some compiler options:
No debug information
Strip all symbols
Optimize generate code

The size reduce to about 2MB, still bit to a simple program!

I've tryied the options to optimize to size, but it isn't what I want!

I need a fast executable, in a reasonable size!

Is that possible?

To compile the libraries, I used this command line:

mingw32-make -f makefile.gcc USE_XRC=1 MONOLITHIC=1 BUILD=release UNICODE=0

I'm using Code::Blocks with MinGW.

Thanks for any tip!

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: Executable size
« Reply #1 on: November 18, 2005, 11:42:00 am »
When using wxWidgets you always get oversized executables or libraries. You can't do anything about that. The only thing you could try to get your executable smaller is to try other compilers. MingW doesn't produce the fastest and smallest code.
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Executable size
« Reply #2 on: November 18, 2005, 12:28:53 pm »
Another thing you can do is add SHARED=1 to the command line. That way, most of the size is split to a dll, meaning it won't be copied to each executable. This won't help if you only have one executable using wx, but if you have several executables using the library the wx code is only on disk once.
This does mean you have another file to distribute with your programs, and you'll have to put it in a place where all executables that need it can find it. Meaning if you have your executables in different directories, you'll have to put the lib in a directory in your PATH variable, or copy the lib to every directory (thus negating the advantage of the dll).