Shrinking wxWindows on Win32

One significant issue with using wxWindows is that it produces a DLL which is quite large.  Unlike using MFC, which is only provided in a single compiled form and already exists of every Windows machine, the wxWindows DLL must be shipped along with each set of applications which use it.  Hence, it's size is important.

The following tests were run on 2003.12.11 with wxWindows 2.4.2 on Win32, with the Visual C++ 7.1 (".NET 2003") compiler.

Original wxmsw24.dll: 2564k

without wxUSE_TREELAYOUT: 2556 (saved 8k)
without wxUSE_PRINTING_ARCHITECTURE: 2480 (saved 76k)
without wxUSE_METAFILE and wxUSE_ENH_METAFILE: 2468 (saved 12k)
        wxUSE_DOC_VIEW_ARCHITECTURE: 2400 (saved 68k)
    (had to wrap mdi.h with #if wxUSE_MDI_ARCHITECTURE)
without wxUSE_REGEX: 2380 (saved 20k)
without wxUSE_WAVE: 2380 (no savings)
without wxUSE_SYSTEM_OPTIONS: 2376 (saved 4k)
without wxUSE_PROTOCOL, wxUSE_PROTOCOL_x, wxUSE_URL: 2340 (saved 36k)
    (that forces wxUSE_FS_INET to 0)
without wxUSE_MIMETYPE: 2308 (saved 68k)
without wxUSE_FONTMAP: breaks build
without wxUSE_JOYSTICK: 2308 (no savings)
without wxUSE_FS_ZIP: 2304 (saved 4k)
without wxUSE_FILESYSTEM: 2288 (saved 16k)
without wxUSE_SOCKETS: 2252 (saved 36k)
        wxUSE_DYNAMIC_LOADER: 2212 (saved 40k)
    (forces wxUSE_MS_HTML_HELP and wxUSE_FSVOLUME to 0)
without wxUSE_CONFIG: breaks build
without wxUSE_STOPWATCH: breaks build
without wxUSE_DATETIME: breaks build
without wxUSE_TEXTFILE: 2140 (saved 112k)
    (forces wxUSE_STARTUP_TIPS and wxUSE_CONFIG to 0)
    (also had to wrap regconf.h with #if wxUSE_CONFIG)
without wxUSE_TEXTBUFFER: 2140 (no savings)
without wxUSE_CMDLINE_PARSER: 2124 (saved 16k)
without wxUSE_LOGWINDOW and wxUSE_LOGGUI and wxUSE_LOG_DIALOG: 2108 (saved 16k)
without wxUSE_CHECKLISTBOX and wxUSE_OWNER_DRAWN: 2084 (saved 24k)
without wxUSE_XPM: 2076 (saved 8k)
    (had to wrap imagxpm.h with #if wxUSE_XPM)
without wxUSE_CONSTRAINTS: breaks build
without wxUSE_SPLINES: 2072 (saved 4k)
without wxUSE_HELP: 2060 (saved 12k)
without wxUSE_DRAGIMAGE: breaks build
without wxUSE_IPC: 2040 (saved 20k)
without wxUSE_CLIPBOARD: 2032 (saved 8k)
without wxUSE_WIZARDDLG: 2016 (saved 16k)
without wxUSE_SPLASH: 2012 (saved 4k)
without wxUSE_FONTDLG: 2000 (saved 12k)
without wxUSE_FINDREPLDLG: 1988 (saved 12k)
without wxUSE_BUSYINFO: 1984 (saved 4k)
without wxUSE_TOOLTIPS: 1984 (no savings)
without wxUSE_SASH: 1968 (saved 16k)
without wxUSE_CARET: 1964 (saved 4k)
    (had to wrap msw/caret.cpp with #if wxUSE_CARET)
without wxUSE_GRID and wxUSE_NEW_GRID: 1784 (saved 180k)
without wxUSE_CALENDARCTRL: 1748 (saved 36k)
without wxUSE_POPUPWIN and wxUSE_TIPWINDOW: 1736 (saved 12k)
(had to wrap popupwin.cpp with #if wxUSE_POPUPWIN)
without wxUSE_LIBJPEG: 1660 (saved 76k)

That's as far as i could take it without removing things that the VTP software actually uses or could potentially use.  The final result is savings of a 904k (35% of the original size).

Changing the compiler's optimization from "Maximize Speed" to "Minimize Size" appeared to have no effect - it is still 1660k.