Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Reducing wxWidgets Executable Size - Use Only Necessary Libraries?

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Reducing wxWidgets Executable Size - Use Only Necessary Libraries?
#3896
Posted by: 2004-04-23 05:10:02
Hi,

I wrote a program using the wxWidgets library, then I wrote the same program in Visual C++. I found that the program writter with wxWidgets was about 2MB, while the same program with Visual C++ was about 20K.

I am using Borland C++ 5.5 to compile my wxWidgets programs. Obviously the entire libary for both wxWindows and the compiler and being included in the executable, which is completely unnecessary.

Is there a way to make my computer decide which files are necessary to include (and include those), and which are not necessary (and exclude those)?
Message2. Re: Reducing wxWidgets Executable Size - Use Only Necessary Libraries?
#3897
Posted by: 2004-04-23 05:20:24
I meant to say: I think that Visual C++ is not including any unnecessary files for the executable to run...there must be a way to do this with wxWidgets. Will it do this (or whatever it does) if I use Visual C++ for wxWidgets instead of Borland C++ 5.5?

("the compiler and being" should be "the compiler are being")
Message3. Re: Reducing wxWidgets Executable Size - Use Only Necessary Libraries?
#3902
Posted by: upCASE 2004-04-23 19:02:06
Hi!
Well, I guess the size of the apps while using a compiler other than VC++ has allways been an issue.
Using gcc here, the smallest app is about 1.2 MB in size, 500 kb when using UPX. With gcc the problem is the C++ specific runtime stuff needed, which is linked to the app. Compiling C programs mingw uses the MSVCRT.DLL which comes with every windows system, thus producing rather small apps. With C++ this can't be done since there is no C++ specific runtime lib.
MSVC compiled apps rely on many system specific dlls, thus reducing the apps size. I guess it is save to say that MSVC
1. does a better job optimizing for size
2. creates smaller apps because all the "rest of the code" is hidden in some DLLs

Take MFC as an alternative framework for Windows. The apps are rather small because there's MFCXXX.DLL which holds the framework code. Compiling wxWidgets as a dll gives the same result, but wxWidgets isn't a standard system dll, so you would have to ditribute it with the app.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-3-28  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0