Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi Library Path - what should really be going in there?

I've been putting the path to the unit (.pas) file folders of our packages into the Delphi Library path but I'm beginning to wonder if this is a mistake! Take this problem for an example:

I have two home grown packages:

  • LowLevelPackage
  • HighLevelPackage

HighLevelPackage uses units contained in LowLevelPackage.

If the path to both package's unit folders are in the library path then there is the chance of me building HighLevelPackage before LowLevelPackage and HighLevelPackage will implicitedly contain LowLevelPackage's units (i think?).

I'm wondering if instead I should be putting the path to the DCUs of these packages into the Library Path. And maybe putting the path to the actual source units in the Browsing Path so we can still step into them when debugging.

Does that sound right? What should really be going into the Library Path? Paths to .DCUs? .DCPs? .BPLs? or .PASs?

like image 209
CodeAndCats Avatar asked Jan 23 '09 01:01

CodeAndCats


3 Answers

Library Path: *.dcu, *.inc, *.dfm
Package Output: *.bpl
Dcp Output: *.dcp
Browsing Path: *.pas
like image 171
Cesar Romero Avatar answered Nov 10 '22 05:11

Cesar Romero


Hmmm, I just had a look at Delphi Help's word on library path:

Library Path Specifies search paths where compiler can find the source files for the package. The compiler can find only those files listed in the library path. If you try to build your package with a file not on the library path, you will receive a compiler error.

I'm not sure I agree with this as it means every package can see every other package's source units so if one package used another packages units and you built them out of order I believe there's potential for dependencies getting screwed up. Oh well, who am I to question Delphi Help, lol. ;)

like image 43
CodeAndCats Avatar answered Nov 10 '22 06:11

CodeAndCats


I usually don't put any package sources into the library path at all. This is because all the 3rd party libraries a project uses go into a subdirectory (svn:external) of the project, so having them in the library path would result in the wrong sources being added to a project. Instead I add the relative paths to the project's search path.

like image 38
dummzeuch Avatar answered Nov 10 '22 07:11

dummzeuch