Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-12

Lazarus Package Library (lpk) - Linking question

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Krzysztof

Hi,

For example BGRAControls package. If I drop TBGRAButton on form, Lazarus automatically add BGRAControls package as required in project inspector. Then, If I build project, it seems that compiler adds all controls from this package to exe even if I don't use them, because if I delete BGRAControls package from required section and add path to BGRAButton unit manually, then exe is much smaller. How does it work? Exists any compilator optimization switch for strip unused units from project packages?

Regards, Dibo

Reply by email

Graeme Geldenhuys
to Krzysztof
Krzysztof wrote
Exists any compilator optimization switch for strip unused units from project packages?

Enable smartlinking. I believe the smartlinking is not 100% as good as Delphi. I also know that LCL pulls in a lot more than needed. I don't know if the latter is due to packages or something else.

What I do know (and what is a real pain with Lazarus Packages), is that if you want to apply new compiler options or optimization to you project, you have to apply those same settings to each and every lazarus package that your project used. This is why I lately prefer to rather set the Unit Search Path, and macros - thus avoiding the use of Lazarus Packages completely - and in return reducing the problems you and I just mentioned.

Regards, ? - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://fpgui.sourceforge.net

Reply by email

Sven Barth
to Krzysztof: For example BGRAControls package. If I drop TBGRAButton on form, Lazarus automatically…
Krzysztof wrote 10 lines
Hi, For example BGRAControls package. If I drop TBGRAButton on form, Lazarus automatically add BGRAControls package as required in project inspector. Then, If I build project, it seems that compiler adds all controls from this package to exe even if I don't use them, because if I delete BGRAControls package from required section and add path to BGRAButton unit manually, then exe is much smaller. How does it work? Exists any compilator optimization switch for strip unused units from project packages?

You might try to disable the option "Add package unit to uses-clause" in the options of the package and see if that helps (I don't know whether it does indeed help, but it's one of the first things I do if I create a package or use one).

Regards,
Sven

Reply by email

Mattias Gaertner
to Sven Barth
Show quoted text 11 lines
On 08.12.2011 19:46, Krzysztof wrote: > Hi, > > For example BGRAControls package. If I drop TBGRAButton on form, > Lazarus automatically add BGRAControls package as required in project > inspector. Then, If I build project, it seems that compiler adds all > controls from this package to exe even if I don't use them, because if > I delete BGRAControls package from required section and add path to > BGRAButton unit manually, then exe is much smaller. How does it work? > Exists any compilator optimization switch for strip unused units from > project packages?

Remove the unit BGRAControls from the uses section. Or use "refactoring / unused units ...".

You might try to disable the option "Add package unit to uses-clause" in the options of the package and see if that helps (I don't know whether it does indeed help, but it's one of the first things I do if I create a package or use one).

It's the default for new packages since some months.

Mattias

Reply by email

Sven Barth
to Mattias Gaertner
Mattias Gaertner wrote 24 lines
On Thu, 08 Dec 2011 21:31:46 +0100 Sven Barth wrote: > On 08.12.2011 19:46, Krzysztof wrote: >> Hi, >> >> For example BGRAControls package. If I drop TBGRAButton on form, >> Lazarus automatically add BGRAControls package as required in project >> inspector. Then, If I build project, it seems that compiler adds all >> controls from this package to exe even if I don't use them, because if >> I delete BGRAControls package from required section and add path to >> BGRAButton unit manually, then exe is much smaller. How does it work? >> Exists any compilator optimization switch for strip unused units from >> project packages? Remove the unit BGRAControls from the uses section. Or use "refactoring / unused units ...". > You might try to disable the option "Add package unit to uses-clause" in > the options of the package and see if that helps (I don't know whether > it does indeed help, but it's one of the first things I do if I create a > package or use one). It's the default for new packages since some months.

I haven't used 0.9.31 since some months, so.... ;)

Regards,
Sven

Reply by email