[fpc-pascal] Will the size of an executable depend on the uses clause

Sven Barth pascaldragon at googlemail.com
Wed Jun 16 14:07:55 CEST 2021

Bo Berglund via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Mi., 16. Juni 2021, 13:32:

> On Wed, 16 Jun 2021 12:30:55 +0200, Mattias Gaertner via fpc-pascal
> <fpc-pascal at lists.freepascal.org> wrote:
> >> Since the final binary size after using strip -s on the exe file is
> >> 271 kb it seems a bit big!
> >> Or is there a lot behind the scenes I have missed?
> >
> >Classes is a hog.
> >
> I commented it away ane recompiled.
> Worked fine so Classes is not needed. :)
> And the executable size after strip -s is now 126 kb. A big improvement!
> But compile did not say used unit Classes was not needed...

Because the Classes unit has initialization and finalization sections. If a
unit contains such it is always considered as needed, after all these
sections might be used to register something in a third unit.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210616/d26bb76e/attachment-0001.htm>

More information about the fpc-pascal mailing list