[Lazarus] OT: Namespaces?

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Apr 7 23:13:44 CEST 2009


On Tue, 7 Apr 2009 18:31:54 +0200
zeljko <zeljko at holobit.net> wrote:

> On Tuesday 07 April 2009 16:59, Mattias Gaertner wrote:
> > On Tue, 7 Apr 2009 15:32:28 +0200
> >
> > zeljko <zeljko at holobit.net> wrote:
> > > On Tuesday 07 April 2009 15:11, Mattias Gärtner wrote:
> > > > AFAIK under Delphi the 'in' modifier has two purposes:
> > > > - mark the unit as part of the project
> > > > - use a unit from a directory which can not be added to the unit
> > > > search path, because there is a duplicate.
> > >
> > > Lazarus uses same logic isn't it ?
> >
> > It does not.
> > What belongs to the project is stored in the .lpi.
> >
> > The codetools support the 'in' modifier and so does the lazarus IDE
> > a bit.
> > But the IDE does not update the 'in' file names and it does not have
> > any special consistency checks for them. So use them only if
> > you know what you are doing.
> 
> I must use them :) 
> 
> > The converter for delphi projects supports them (fix the
> > file cases, adds them to the lpi).
> >
> > > I already have such projects where
> > > I must use "in" like in delphi.
> >
> > Please give a complete example. Maybe you are doing something wrong.
> 
> I have two dirs with projects, both have main.pas, but project2 uses
> some units from project1 dir.
> So:
> 1.I must include project1 dir into project2, but sometimes , when
> building project2 lazarus (eg. when have some error in code), raised
> main.pas from project1 , but it shouldn't, it must open
> project2/main.pas. In kylix this is normal (because of "in"), so each
> unit is properly recompiled.
> 
> I've seen that it's little bit messy and tricky with fpc, so my
> settings for eg. project2 are:
> 1.project1 units , which are used in project2 ARE included
> inside .lpr with "in" like myunitfromproj1 in
> '../project1/myunitfromproj1.pas' etc.. 
> 2.project1 dir is removed from my units path. 
> 3.-FU is setted up to project2 dir.
> 4.Laz application output path is at third place ... eg.
> myBuilds/project2
> 
> Now it does not make any mess. Maybe I'm wrong ... but it works for
> me.

I compiles. But it dos not work well in the IDE, because it does not
know what to do with '../project1/myunitfromproj1.pas'. For example it
does not know where to search the units used by myunitfromproj1.pas.

Normally shared units are put into a separate directory and then you
either create a package for it or you add it to the unit path.


Mattias




More information about the Lazarus mailing list