<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">LacaK via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Mi., 10. März 2021, 10:34:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
my goal is DO NOT include unused procedures, methods in final <br>
program/library on Win32 target exe/dll.<br>
<br>
A.) I compile my (units) program/library with -CX -XX (set in Project <br>
Options)<br>
<br>
B.) I did also experiments with WPO: -OWall -FWprogram.wpo -Xs- (plus <br>
-Owall -Fwprogram.wpo)<br>
<br>
Questions:<br>
<br>
1. I did not notice difference between A and B (it seems like WPO did <br>
not reduce size of EXE (may be that I do something wrong))<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">It might simply be that WPO did not have anything to do. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1.1 is there way how I can check which procedures were striped out or <br>
vice-versa included?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">You can create a map file using -Xm. This will list all sections that were included, though it's quite a read. ;) </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
2. Is smart-linking/WPO capable to remove unused:<br>
2.1  regular procedures/functions ?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Done by smartlinking. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2.2  methods of classes (non virtual, virtual) ?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">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. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2.3  class methods of classes ?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Done by smartlinking. </div><div dir="auto"><br></div><div dir="auto">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. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>