[Lazarus] Strange dependency of units

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Mar 31 20:20:37 CEST 2012


On Sat, 31 Mar 2012 19:41:02 +0200
Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:

> Mattias Gaertner schrieb:
>  > The hint was about a tool that reduces the burden of knowing to
>  > which package a unit belongs, search paths and dependencies.
> 
> Why is this at all necessary? I don't get it of what use such a 
> complicated and error prone construct like packages should serve for if 
> it is not rock solid. Is this an improvement over simple to use units? 
> In units, all dependencies are automatically(!) resolved by the 
> software. Why is this impossible for packages? I was not even aware that 
> I used a package. I just used a unit (grids).

In Lazarus packages are groups of units. This is not only useful for big
projects, it makes sharing code easier in general. Each
package has its own compiler options. For example the LCL units need
some flags like inlining and C style operators and some linker options.
When you copy a package to another machine you don't have to adapt any
search paths or compiler options. 
When some compiler option changes or a sub directory is renamed or the
package is moved to another location on you disk, you don't have to
adapt all your projects that uses the package.
Packages allow to share ppu files. You don't have to recompile
the LCL for every project. Each package has its own directory where its
ppu files are stored.

And packages can do more than compiling. For example documentation and
translation.

Mattias




More information about the Lazarus mailing list