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

Graeme Geldenhuys graemeg.lists at gmail.com
Wed Apr 8 08:40:38 CEST 2009

On Tue, Apr 7, 2009 at 5:13 PM, Marc Weustink <marc at dommelstein.net> wrote:
> No, but the problem is caused by the way fpc stores info in the .ppu
> Somehow it is possible that the checksum of the interface part stored in
> the .ppu is affected by the implementation section.

Since I started using Lazarus (4+ years ago), I have only two had a
checksum issue compiling lazarus. A simple 'make clean' and then
recompile resolved the problem. But I actually think the issue was
caused due to a FPC upgrade - I can't remember exactly, but am pretty

> To avoid this and to make the LCL usabole as "library", most unit circles
> were removed. One way to ensure that is by putting all uses in the
> interface section.

OK I'm confused. How does solving circular reference get resolved by
putting everything in the Interface section? Doing that is what causes
circular reference problems??  Maybe I understand circular reference
problems differently to you... this is what I mean:

{ this defines TClass1 }
unit Unit1;


   TClass1 = class(TObject)
      FRef: TClass2;


{ this defines TClass2 }
unit Unit2;


   TClass2 = class(TObject)
      FRef: TClass1;


Both classes require each other and can't be compiled. This is what I
understand as circular unit references.  To solve this you can lump
both class definitions in a single unit and add a 'forward
declaration' at the top.

>> any issues. I limit the usage of interface uses clause as much as
>> possible. I believed that is why the smartlinking works so well with
>> fpGUI - I can create a GUI application that is only 340KB in size.
> Anyway, back to the subject, I cannot imagine why FPC when smartlinking
> makes a difference between interface and implementation uses. Especially
> if you use an external linker, like on linux.

OK, I worded that wrong. For smartlinking there shouldn't be any
difference if the unit is in the Interface or Implementation section.
What is important is if the unit is used or not. I think the reason I
can get such small executables, is because every gui component lives
in it's own unit. fpGUI doesn't have a StdCtrls or ComCtrls unit which
lumps a whole bunch of classes together. And when I create
applications I only add the units I really need. This is obviously

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the Lazarus mailing list