Optimizer.pl – tool for eliminating redundant exported symbols.

Make new optimized .def-file (first step) or make lists of unused export symbols (as second step).

Synopsis:

perl optimizer.pl [-pro] -c|a

Description

-a

Analyse the stand. This should be used as a first step. New, optimized .def files are produced on this step.

It is recommended when finished this first step to build the libraries with modified wnt.mk. If you remove /OPT:NOREF option for linker in this file, you'll get fully optimized version of libraries (there's no guarantee that it will be working version). You get also correspondent .map file. It seems to worth efforts to analyse stand again and rebuild libraries, since now some unused imported symbols might be thrown away.

-c

Compare the lists. This should be used as a first step. On this step new .map files and old .map-files are compared and file with obsolete symbols is stored in the same directory as .obs, where these two are.

How it works:

This tool is a Perl script, its functionality is implemented on analysis of .def and .map files produced by MS linker cl.exe. It must be started from the main directory of the stand whith corresponding options.

The tool parses symbols imported from another libraries in correspondent .map files and makes a complete t imported symbols table (IST) in memory. When all .map files are parsed and complete IST is made, .def file for each library is analysed and if there are symbols which are not found in IST, than they are thrown away in new .def file. Former .def file is backed up as .olddef if there were no .olddef file before. You get the entire list of the libraries and projects to be rebuilt if any new .def files were made. There are some symbols which are exported a priori (a priori export symbols (APE), they are:

component_getDescriptionFunc

component_getImplementationEnvironment

component_getFactory

component_writeInfo

This table can be enlaged when needed. This tool enables to reduce libraries' size, but there is no warranty, that optimized library would be working correctly. This may occur when there are symbols that must not be thrown away, but they are not imported by any library explicitely. Such symbols should be taken into account when optimizing, that is taken into APE. This tool was developed with intention to reduce export tables of libraries and to produce list of probably unused symbols.