[Lazarus] When adding a packages it adds to uses clause
Graeme Geldenhuys
graemeg.lists at gmail.com
Tue Jul 8 00:09:46 CEST 2008
2008/7/7 Vincent Snijders <vsnijders at quicknet.nl>:
> To support package, which only do registration, like for example the
> jpeg reader (not used atm). It registers its reader in the intialization
> section of one the units in the package, but is not used anywhere in the
> application further on.
Surely there must be a smarter way for Lazarus to know when to include
or not include the package unit into a project. I just tested Philip
Hess's theory and he is 100% correct.
I compiled a simply application using fpgui_toolkit.lpk package (no
smart linking) and with 'fpgui_package' in uses clause. A 4.3Mb
executable was created. I enabled smart linking and the file shrunk
to 3.5Mb. I then removed the 'fpgui_package' reference in the uses
clause and it shrunk further to 2.8Mb. That's a HUGE difference
compared to the previous tries.
Oh, and I ran 'strip' on each executable. The first 4.3Mb file went
down to 2.9Mb. The last 2.8Mb file went down to 590Kb.
As far as I know, a Lazarus Package contains a flag or something to
say it's got a Register() function. In that case include the package
unit in the uses clause. If the packages doesn't contain a Register()
function, exclude it from the uses clause!
When deploying apps over the internet every byte counts! No need to
follow Microsoft's idea of creating every application with bucket
loads of bloat.
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
More information about the Lazarus
mailing list