www.digitalmars.com         C & C++   DMDScript  

c++.wxwindows - How can i get a smaller program?

reply "danny" <danny hftc.com.cn> writes:
I use dmc8.41 and wxwidgets 2.4.2.
I build the lib use \src\msw\makefile.sc.
then write a simple app just show a frame.
but the app size 1.2M, with -g the size grow up
to 1.7M.
but  with VC++6, only 500K, how to reduce the
applicatin's size?
Jan 18 2005
next sibling parent reply chris elliott <biol75 york.ac.uk> writes:
You might like to see my table at 
http://biolpc22.york.ac.uk/wx/wxhatch/wxMSW_Compiler_choice.html

The main problems are in the linkers, I think

So you can make the program smaller by setting unused bits of the libary 
to 0 in setup.h

chris

danny wrote:
 I use dmc8.41 and wxwidgets 2.4.2.
 I build the lib use \src\msw\makefile.sc.
 then write a simple app just show a frame.
 but the app size 1.2M, with -g the size grow up
 to 1.7M.
 but  with VC++6, only 500K, how to reduce the
 applicatin's size?
 
 

Jan 20 2005
parent "danny" <danny hftc.com.cn> writes:
Thanks a lot.
I have seen the table before. But I note you didn't mention the size under
release configuration with Digital Mars.
The makefile in the wxwidgets without a releaseconfiguration. I'm not
familiar with the bakefile, so I modify the  makesc.env , delete the
_D__WXDEBUG in the CFLAGS line. Make success, but the size of the lib only
shrink a little.
I don't know if this is a right way.
I'll try the setup.h later time.


 You might like to see my table at
 http://biolpc22.york.ac.uk/wx/wxhatch/wxMSW_Compiler_choice.html

 The main problems are in the linkers, I think

 So you can make the program smaller by setting unused bits of the libary
 to 0 in setup.h

 chris

 danny wrote:
 I use dmc8.41 and wxwidgets 2.4.2.
 I build the lib use \src\msw\makefile.sc.
 then write a simple app just show a frame.
 but the app size 1.2M, with -g the size grow up
 to 1.7M.
 but  with VC++6, only 500K, how to reduce the
 applicatin's size?


Jan 21 2005
prev sibling parent reply Michael Hagley <Michael_member pathlink.com> writes:
In article <cskjgu$bl5$1 digitaldaemon.com>, danny says...
I use dmc8.41 and wxwidgets 2.4.2.
I build the lib use \src\msw\makefile.sc.
then write a simple app just show a frame.
but the app size 1.2M, with -g the size grow up
to 1.7M.
but  with VC++6, only 500K, how to reduce the
applicatin's size?

You can strip the executable of the symbol table and relocation bits by using the "% cc -s yourapp.c" command. Once you've done that, it should be significantly smaller. You could also try using an executable compressor like UPX to make your executable even smaller.
May 06 2006
next sibling parent chris elliott <biol75 york.ac.uk> writes:
you might like to look at
http://biolpc22.york.ac.uk/wx/wxhatch/wxMSW_Compiler242_choice.html

(see also 
http://biolpc22.york.ac.uk/wx/wxhatch/wxMSW_Compiler_choice.html where 
the bakefile build system was used)

My impression for 2.4 is that the differnces in size between linkers 
soon disappear when the size of your program starts to increase; with 
the minimal sample there is a ratio of 1:4 in sizes, but for my more 
complex test case (wxhatch) the ratio is much smaller

The usual answer to making the file smaller is to turn off the parts of 
the wxW library in setup.h (hint: remove all the setup.h files you can 
find, edit setup0.h, and recompile the library

chris

Michael Hagley wrote:
 In article <cskjgu$bl5$1 digitaldaemon.com>, danny says...
 I use dmc8.41 and wxwidgets 2.4.2.
 I build the lib use \src\msw\makefile.sc.
 then write a simple app just show a frame.
 but the app size 1.2M, with -g the size grow up
 to 1.7M.
 but  with VC++6, only 500K, how to reduce the
 applicatin's size?

You can strip the executable of the symbol table and relocation bits by using the "% cc -s yourapp.c" command. Once you've done that, it should be significantly smaller. You could also try using an executable compressor like UPX to make your executable even smaller.

May 09 2006
prev sibling parent Def <Def_member pathlink.com> writes:
In article <e3hrqf$2ao1$1 digitaldaemon.com>, Michael Hagley says...

 [...] You could also try using an executable compressor like
 UPX to make your executable even smaller.

This can not always be recommended, however, for production code (meaning programs you want to sell). It's not the fault of UPX, but I remember there have always been problems caused by buggy or too aggressive heuristics of anti-virus software. Of course, you don't want your customers to get a virus warning from your program (even if it's a false one). All of the above is IMHO. ;-) Def
May 10 2006