[Lazarus] Size of binaries etc.

Martin lazarus at mfriebe.de
Wed Mar 21 14:46:11 CET 2012

On 21/03/2012 13:15, Mark Morgan Lloyd wrote:
> Martin wrote:
>> To get it further down, find initialization sections throughout the 
>> LCL, and disable stuff you do not need.
>> e.g. graphics uses units for the different gfx formats, if you do not 
>> use png, comment out the registration (though I am fot sure what is 
>> needed for icons...). That can save a few 100K if you are lucky. 
>> (Having that in, is the price for using RAD) (I did test this one a 
>> few years back)
>> Not sure, not tested, but you may also find resources included (such 
>> as icons) and decide you can do without, or with less. (Only 
>> guessing....)
> Noted, but not something I'd much like to do for a project being 
> published since it would leave me open to a lot of questions if 
> somebody tried to recompile and got a wildly different size.

In that case I guess there is little you can do.

There would be ways to change the LCL, to get a few 100 kb size down. 
And I have/had a dream to look at this. But it is unlikely that I will 
ever have the time for it.

One Idea is to introduce a unit "GraphicsBase" (or similar) with 
dependant units, so that no image decoders are referred in the 
initialization (then they should be smart linkable).
That unit could be used throughout LCL and packages (making sure any 
unit that requires a specific image format, still uses the unit, which 
registers that.

The unit Graphic, would use all the "registration" units, and forward 
all interface declaration.

Any LCL based app uses graphics in the user unit. That would be kept 
default. So all existing app (and all unmodified new apps) would work 
100% as they do now.

But a user can change the uses clause in his own app, and drop some balance.

However, that is a lot of work, lot of testing, lot of maintenance. And 
still at best a few 100 kb of size saved. Then the search would have to 
be continued, where else can some ballast be removed....

More information about the Lazarus mailing list