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

Marc Weustink marc at dommelstein.net
Tue Apr 7 17:13:07 CEST 2009

Graeme Geldenhuys wrote:
> 2009/4/7 Mattias Gärtner <nc-gaertnma at netcologne.de>:
>> Uses sections in implementation sections are buggy as long as I know fpc. The
>> problems are known but apparently too hard to track and fix. The bugs appear at
>> random and with various degrees depending on platform and fpc version. In some
>> years you think the bugs are fixed, and then they come back.
>> You have been warned: Don't use the imp sections.
>> I thought this was known:
>> http://wiki.lazarus.freepascal.org/DesignGuidelines
> This is the first I here of this. I was always taught to limit the
> usage of the Interface section's uses clause, so you can prevent
> circular unit issues. So is FPC the opposite of Delphi in this
> regards?

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.
When editing sources this can lead to strange results, the compiler 
might think in some cases an interface is changed or not.
When Lazarus started we put a lot in the uses section of the 
implementation part. When some source was changed, sometimes a 3 or 
fourtime compile attempt was needed to compile the while LCL, since 
everytime the compiler thought a unit was changed whil it was not. 
Restarting compilation (and keeping the existing units) in most cases 
resulted in a compiled LCL.
To avoid this and to make the LCL usabole as "library", most unit cirles 
were removed. One way to ensure that is by putting all uses in the 
interface section.

> I have used FPC since 2.0.2 under Linux and Windows and haven't had
> 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.

It might depend on how you compile fpGUI.

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.


More information about the Lazarus mailing list