[fpc-devel] Delphi smart-linking perspective ( Language change and implementation ... )

Daniël Mantione daniel.mantione at freepascal.org
Sun May 31 10:45:20 CEST 2009



Op Sun, 31 May 2009, schreef Jonas Maebe:

> Yes, the but the results are not very impressive. The reason is due to the 
> way the LCL is constructed, almost every declared class can theoretically be 
> instantiated. On the other hand, I read that recently the LCL was 
> restructured a bit to improve the situation, so maybe the results would be 
> better now.
>
> Also note that WPO can do little about published methods (since it must 
> assume that these can all be called via RTTI).

Also not that many references through initialization are just one part of 
the equation. Many code is referenced through resource files, i.e. if a 
class X can appear in a resource file, the code to construct the class 
must be in the executable, even though class X will not actually be in the 
resource file.

One area that particulary demonstrates this is the Tform, it has a lot of 
fields that can optionally contain a reference to another class. Even when 
you set all these fields to nil and never construct such a class, there 
code will end up in the executable, because the executable will only learn 
that the field is set to nil when it processes the resource file at 
runtime.

These two aspects (unit initialisation and resource files) make both 
Delphi and Lazarus executables grow quickly, the LCL more because it 
has more initialization references than the VCL.

Daniël


More information about the fpc-devel mailing list