views:

1530

answers:

4

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?

+6  A: 
Library Path: *.dcu, *.inc, *.dfm
Package Output: *.bpl
Dcp Output: *.dcp
Browsing Path: *.pas
Cesar Romero
Really? Why would *.dfm files go into library path when .pas files wouldn't? That doesn't make any sense to me. Pas files and dfm files live together.
Ben Daniel
Another thing: .inc files also usually in the same folder as pas files since pas files are usually using them. I see no reason why inc files should go into the library path. Do you think you could add some reasoning to your answer?
Ben Daniel
The .dfm and .inc files is used by linker, when you compile your app.If you let the .pas files in Library Path, the pas will be recompiled each time.using this way, your compile time will be very short.
Cesar Romero
dfm files must be accessible by the compiler. And the compiler only looks into the library path. (The main problem here is that the IDE doesn't allow you to specify a different path for resource files, the command line compiler has a -R option for this)
Andreas Hausladen
@Cesar: If I separate files like you said, what happens if I make a change to some .pas file that's part of another package (not part of my current project)? Do I have to open that package and compile it every time I need to change such a .pas file before recompiling my current project?
Liron Yahdav
@Cesar: Another question: Are you suggesting I go to every 3rd party package I have installed in Delphi and change them to compile .dcu files into a folder separate from where the .pas files are located?
Liron Yahdav
@Liron: for both of your questions, it is the way I manage my projects and 3rd party packages.
Cesar Romero
A: 

+1 to Cesar, though I wasn't aware of a "Browsing Path" option... I'm pretty sure it wasn't there in D7. That would certainly save having to add PAS files to the Library Path in order to step through code.

moobaa
Yeah, there's a Browsing Path in Delphi 7. Yeah, it's good stuff.
Ben Daniel
@moobaa: Is this an Answer or a Comment?
Argalatyr
using Delphi 5, browsing path is there !
Newtopian
+1  A: 

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. ;)

Ben Daniel
Exactly, and now, I think you understook my answer.
Cesar Romero
+1  A: 

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.

dummzeuch