[fpc-pascal] Minimal size of compiled library (DLL under Windows)

LacaK lacak at zoznam.sk
Tue Apr 6 12:22:47 CEST 2021


May be, that important word is here "referenced" code.
Once some code (procedure, class) is referenced then this code is linked 
/ included.
It does not play role if it is really required by program / library ... 
right?

L.

>> So we see that classes like TComponent and also interfaces are touched,
>> but they are used only in conjuction with initilizing some global
>> variables like InitHandlerList, GlobalNameSpace.
>>
>> But these variables are never used in my library. Only again in
>> finalization sections of above mentioned units.
> They are used in your library as far as the linker is concerned, because
> the init and finalisation sections are code like any other code.
>
>> Does it means, that smart-linking can not remove this code due to usage
>> of this global variables in finalization section (resp. initialization
>> sections)?
> Indeed.
>
>> Probably it is too hard task for linker to determine which code is realy
>> not needed ... WPO in this regard can not help?
> No. There is no way for WPO to know what side effects the initialisation
> of those variables could have.
>
>
> Jonas
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


More information about the fpc-pascal mailing list