LacaK via fpc-pascal schrieb am Mi., 10.
März 2021, 10:34:
Show quoted text 16 lines
Hi,
my goal is DO NOT include unused procedures, methods in final
program/library on Win32 target exe/dll.
A.) I compile my (units) program/library with -CX -XX (set in Project
Options)
B.) I did also experiments with WPO: -OWall -FWprogram.wpo -Xs- (plus
-Owall -Fwprogram.wpo)
Questions:
1. I did not notice difference between A and B (it seems like WPO did
not reduce size of EXE (may be that I do something wrong))
It might simply be that WPO did not have anything to do.
1.1 is there way how I can check which procedures were striped out or
vice-versa included?
You can create a map file using -Xm. This will list all sections that were included, though it's quite a read. ;)
2. Is smart-linking/WPO capable to remove unused:
2.1 regular procedures/functions ?
Done by smartlinking.
2.2 methods of classes (non virtual, virtual) ?
The former is done by smartlinking (if they aren't required for e.g. published properties). The later might be done by WPO, though I think that the case of a virtual method not being used at all is not handled.
2.3 class methods of classes ?
Done by smartlinking.
In essence you gain the most by smartlinking. WPO only works in certain situations (e.g. the compiler has a class hierarchy that works very well for devirtualisation) and some things that could in theory be done with WPO are simply not implemented.
Regards,
Sven