Prof-UIS has many classes’ functions, and resource, and probably only a few of the total resource are actually utilized. The prevailing thought is that the linker will strip out the unused items. Except the linker doesn’t seem to strip out all items and certainly does not remove their resource.
This is a study of how one project was able to reduce the size of an executable so that download volume and times were significantly reduced.
TapeCalc.exe one of TSELLC products had a build size of 18612, with an MFC and Prof-UIS libraries included. The result of this project will be TapeCalcPLUS .exe and TapeCaLcFREE.exe programs.
NOTE: 39 percent is a sizable reduction in a program.
|Initial Size of TapeCalcPLUS.exe
|Additionally Removed all but English Language
|Additionally Removed Ribbon Bar, Res2010.rc,
Here is the process I used to get these results.
I first put the Library build file (ProfUISLIB.sin*) in my project. This allowed making changes to both the library and the project at the same time.
The two files that you need in your work area are resource.rc located in C:\prof-uis-294\Include\Resources, and prof-uis.h located in C:\prof-uis-294\Include. As you can see these files are in my release 2.94 directories.
The Resource.rc File Modifications
At line 38 in the Resource file you will see a list of statements that are commented out, like:
Un-define all of these language you are not going to use. If you are going to use all of the languages you will not get a saving. If you are not hot switching the languages only undefined the language you are using in the current compile.
Next are a set of global resource defines. If you are not going to use these features remove the defines for their resources.
TapeCalcPLUS does not use ResGeoControls so we commented out
The best was to do this is to have a conditional define for this resource file like
#if !defined( __TAPECALCPLUS___)
With this define the Library will function correctly for you other projects that may need these resources.
Modifying the Prof-UIS.h file
At Line 101 in the Prof-UIS.h file there is a list of defines.
What these defines will do is disable functions of the Prof-UIS Library.
The three that we were able to activate were:
If you are using the feature then you can disable the feature and it resources.
NOTE: It’s not clear whether removing more features will provide increased size reduction. The saving mainly comes from static code and resources.
In the event that you get link errors in this process check carefully the functions you have excluded. I then turn them all on to make sure it’s not in the library. Then turn them off one by one.