[fpc-devel] Purpose of "uses ... in"?

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Jul 21 18:35:53 CEST 2010


On Wed, 21 Jul 2010 11:04:37 +0200
Zaher Dirkey <parmaja at gmail.com> wrote:

> On Wed, Jul 21, 2010 at 8:37 AM, Mattias Gaertner <nc-gaertnma at netcologne.de
> > wrote:
> 
> > On Tue, 20 Jul 2010 19:57:39 +0200
> > Zaher Dirkey <parmaja at gmail.com> wrote:
> >
> > > uses
> > >
> > > >    myunit in '..\lib\myunit.pas',
> > > >
> > > > it is no need to change it even in the search path.
> > > >
> > > >
> > > I meant my project have folders like
> > > /proj/bin
> > > /proj/src
> > > /proj/lib
> > > i can move the dir /proj or my component package to any dir without need
> > a
> > > changes.
> >
> > So it is with search paths. They don't need to change when you move
> > your /proj.
> > I don't see your point.
> >
> >
> If i have project use some source of components,not use  *.o files,
> My proj1 use component lib1.pas but lib1.pas need unit unit1.pas in sub dir
> (/mylib/src/sqlite/unit1.pas) of same dir of lib1.pas
> 
> /proj1/bin
> /proj1/src
> /proj1/lib
> /proj1/addons
> 
> /mylib/src
> /mylib/src/sqlite/
> /mylib/src/firebird/
> 
> in fact i must add all in search path, while if i put in /mylib/src/lib1.pas
> in uses
> uses
>   sqlite in './sqlite/sqlite.pas';
> 
> now i can move copy to friends, make it from another platform
> (linux/windows) and send the examples without worry about the paths, may be
> i need to change one path

Changing a search path is simple.
And with Lazarus projects/package you don't even have to adapt search
paths when moving projects/packages on disk or to other computers.

But when you move some units around in your project, then you
must check all 'in'. With search paths you only have to check one
place. And again Lazarus and MSEGui helps you here.

 
> May be the point got when i build site using PHP :)

I still think, search paths are in almost all cases easier and more
powerful than 'in'.

Mattias



More information about the fpc-devel mailing list