[Lazarus] Large program size - 1.8 MB for empty GUI project

Mattias Gärtner nc-gaertnma at netcologne.de
Wed Apr 8 18:25:53 CEST 2009


Zitat von Reenen Laurie <rlaurie at gmail.com>:

> 2009/4/8 Alexey S. Smirnov <betatester at rambler.ru>:
> > The Smart Link process should check what variables/functions/definitions
> are
> > used in your project to cut off unused code. It is really simple to do so,
> > if some units are listed in Implementation section - linker will only add
> > unit functions that are mentioned in you code, not more.
> > If units are listed in Interface section - it mean that potentially all
> > code  from that particular unit should be included. Because your global
> > variable/class should have access to all provided
> > code/procedures/properties.
>
> Marc Weustink (i think wrote):
> > Just a note: some people think that units can be compiled in one pass -
> > this is not true. The compiler must stop on every Uses clause, and
>
> So .exe's should be (much) smaller if your uses units are put mostly
> in implementation (not easy to find circular references), but we say
> rather put it in interface?

No. If yes, then you spotted a bug in the compiler and/or linker.


> If we have to do multipass why is it necessary to have a distinction
> at all?  (Ok, because writing compilers isn't exactly a walk in the
> park)...

1. Sometimes you need unit circles, then you need imp uses sections.
2. Some other pascal compilers provide more features than Delphi.

It is personal choice what you prefer:
Use only intf sections to avoid circles.
Use only imp sections ... oh that is not possible.
Use mostly imp sections to reduce intf dependencies. For smart linking you
should not create imp dependencies too, so don't use imp sections neither.

In other words:
Avoid uses sections, if this is not possible: use only intf sections. That
avoids circles and improves smart linking.


Mattias




More information about the Lazarus mailing list