Delphi library paths - best practice

A question I posted sometime ago (Delphi regkey support) was around better controlling library paths for different projects (as I use the -r flag for this).

In the absence of that feature, I’d like to know what is the recommended setup for defining the library path at the project level. Eg. Unchecking the “Use registry for library paths” and setting the Win32,Win64,OSX… fields to a variable that I initialise in the script perhaps? I’m aware of rsvars.bat but just calling that doesn’t help with BDSLIB, etc.

Any pointers appreciated.

Ian

I had a look at the old thread to remind myself what it was about. I did actually look at supporting the reg keys in the FinalBuilder action, but decided it was too risky (of breaking peoples projects) as the virtualised delphi variables (like BDSLIB) etc are created when FB starts up, and it would be a major code change.

So for now I guess the thing to do uncheck the Use registry option and use a variable to provide the library paths in your FB project.

FWIW I found some time in the last week to work on my package manager project and have made some progress, hope to have something to show in the next few weeks.

Thanks Vincent

OK, for now I have:

a) Created project variables:

  • BDS
  • BDSLIB
  • BDSINCLUDE
  • DELPHILIBWIN32
  • DELPHILIBWIN64

Didn’t think I needed BDS* vars but found it necessary.
Also, I don’t reference BDSCOMMONDIR so ignored it.

b) Unchecked “Use registry for library paths” in Delphi options

c) Set the Win32 library path to: $(DELPHILIBWIN32)
d) Set the Win64 library path to: $(DELPHILIBWIN64)

e) Finally, in the project script, added actions to set variables:

  • BDS
  • BDSLIB
  • BDSINCLUDE
  • DELPHILIBWIN32
  • DELPHILIBWIN64

The latter two equating to the Search Library path in the IDE.

This seems to work, but would like to confirm that manually declaring and assigning BDS* variables do not cause problems with the virtual variables referenced in the Delphi action?

Also, will take advise if there is a better option.

TIA

This will probably work, but bear in mind that

would not have the same values when used inside the Delphi action. This is probably ok, in that you probably needed to define them due to variable expansion on the DELPHILIBWIN32 & DELPHILIBWIN64 variables? If thats the case, then you should escape the their references the lib variables, eg.

$$(BDSLIB);$$(BDS)\imports; 

and then remove the project variables as they won’t be needed. BDS and BDSLIB will expand to the correct values in the action at runtime (due to the recursive variable expansion that FB does).

Hope that’s clear.

Yes, I did need to define them for the DELPHILIBWIN32/64 expansion.
However, your $$ escape idea worked :slight_smile: At least with a quick test just now. I could eliminate the BDS* variables, so one less thing to maintain with a Delphi upgrade.
I’ll report back if any other issues. Cheers

1 Like