[Lazarus] Creating packages - what to include?

Jean SUZINEAU jean.suzineau at wanadoo.fr
Mon Dec 28 21:32:44 CET 2020

Le 28/12/2020 à 18:13, Bo Berglund via lazarus a écrit :
> Could you please direct me to where in Lazarus this can be done?

Usually when I add a unit uA.pas to a project (by opening the unit in 
the code and then hitting Shift+F11 or Project/Add editor file to 
project), Lazarus asks me if I want to add this path to the search path 
for units.

There can be a problem if you further create a visual component in a 
unit uB.pas that uses uA.pas.

You will need to create a package for uB.pas or add it to an existing 
package. Let's call this package pB.lpk .

In this case you can no longer add the directory of uA.pas to the search 
path, because you'll end up with duplicate ppu files. (I'm not sure of 
the error, but Lazarus and the compiler complain and advise you to use 
the package).

To address this problem, I have a specific package pA.lpk where I put 
uA.pas, and I add pA to the dependencies of pB .  (eventually, you can 
put all you common code in a single package too)

In my real code pA is the package**OD_DelphiReportEngine_Units.lpk where 
I put all my units which can run headless in console with no GUI ( 

And pB is OD_DelphiReportEngine_Controls.lpk where I put all my custom 
controls (visual components) 

I even had a third intermediary package 
OD_DelphiReportEngine_Components.lpk for non visual components which can 
be used for example in datamodules in console apps working with 
databases ( 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20201228/f30cac49/attachment.html>

More information about the lazarus mailing list