How are Delphi 'environment variables' such as $(BDS) evaluated?

1) They are simply environment variables which Delphi sets for its own process and you can retrieve them with GetEnvironmentStrings from a design package installed in the IDE; here's an example.

1) They are simply environment variables which Delphi sets for its own process and you can retrieve them with GetEnvironmentStrings from a design package installed in the IDE; here's an example. If your installer is a separate executable, you can still (more or less reliably) guess where to get some of the values: BDS: RootDir value in the registry, e.g. HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\8.0\ BDSCOMMONDIR: in older versions (Delphi 2007, I guess) this was a global environment variable, set by the Delphi installer.In later versions you can find it in rsvars.bat. Some others might probably be derived, e.g. : BDSLIB: $(BDS)\lib BDSINCLUDE: $(BDS)\include User-defined variables (defined in Delphi's Environment Options dialog) are stored in the Environment Variables registry subkey.2) The $(...) notation is IMHO simply better because it has distinct opening and closing delimiters, it's easier to work with for search/replace operations and also more readable.

They're probably generated relative to the running BDS. Exe, and meaningless outside the process, since you can have multiple BDS installs. The best persistent place you're likely to find would be the uninstall registrations.

– Craig Peterson Jul 29 at 14:44 @Craig: because they are useful in many more situations than just the IDE.It would be nice if they could be re-used in a build server. Now you have to duplicate these kinds of settings in there as well. – Marjan Venema Jul 29 at 17:46.

David is right that these variables are specific to Delphi (and C++ Builder), and they are not available as "normal" environment variables. However, they can be looked up in the registry. The key is: HKCU\Software\\BDS\\Environment Variables.

Any custom "environment" variables that you add can be found here as well. For example I have a $(MVC) variable to point to the folder where all my components(' versions) can be found. At work we use the registry to look up the values in a script/app combination to convert dprojs to cfg files for our build server which uses the command line compiler.(As we don't use the IDE on the build machine, we have added our custom Delphi environment variables to the registry manually).

Update Actually, the Environment Variables key is used for user defined environment variables and for overrides of the "standard" BDS environment variables. The default values of any $(BDS*) environment variable is nowhere to be found in the registry... So, current knowledge says, if you want to get your hands on the values for the $(BDS*) vars, you would have to override the default values and read the ones you specified from the Environment Variables key.

AFAIK, the Environment Variables subkey is for user-defined variables. For Delphi XE, I don't see BDSLIB defined anywhere in the registry. Neither in HKEY_CURRENT_USER nor HKEY_LOCAL_MACHINE.

– TOndrej Jul 29 at 9:16 1 @TOndrej: you are right, though overrides of the default values for $(BDS*)'s can be found there as well, so you should always look there. The value for $(BDS) is found in: HKCU\Software\\BDS\\RootDir. Looking for the others... – Marjan Venema Jul 29 at 9:31 Negative.

David is not right and those are simply enviroment variables, set by process and (naturally) inherited by children. – Premature Optimization Jul 30 at 11:29 @Downvoter: yes they are environment variables, set by the IDE and as such only accessible to the IDE or processes started by the IDE. They are not "simply environment variables" as they are not available outside of the IDE process tree.So David is/was(?) perfectly right in saying that they are specific to Delphi even if Delphi chose to use environment variables to implement them.

– Marjan Venema Jul 30 at 15:00 @Marjan Venema, no, they are simple and not magic at all, you just have severe misconception about environment variables. Create a seperate question and/or exercise viewing enviroment block of IDE process. – Premature Optimization Jul 30 at 17:59.

The $() notation for variables is a convention used by MAKE, what Borland used as build tool before switching to MSBuild. (in D2007? ).

Yes, exactly. I was really surprised what people talk about "build servers" here, but have no idea about make. Little correction: syntax was not invented by broland, but was common even before broland.

– Premature Optimization Jul 30 at 11:32 sure, pmake and gmake use it too. IIRC some shells (tcsh? ) too.

– Marco van de Voort Jul 31 at 9:25.

I'm working on a bit of command line build automation (because I want to move away from Final Builder) so I had to deal with those special variables. To invoke the command-line compiler we're supposed to either invoke the command prompt using the "RAD Studio Command Prompt" from the Start menu, or to include the "rsvars. Bat" script into our own scripts.

That rsvars. Bat script looks like this: @SET BDS=C:\Program Files (x86)\Embarcadero\RAD Studio\7.0 @SET BDSCOMMONDIR=C:\Users\Public\Documents\RAD Studio\7.0 @SET FrameworkDir=C:\Windows\Microsoft. NET\Framework\v2.0.50727 @SET FrameworkVersion=v2.0.50727 @SET FrameworkSDKDir= @SET PATH=%FrameworkDir%;%FrameworkSDKDir%;%PATH% @SET LANGDIR=EN As you can notice, the very special BDS variable is set in there, as well as some others.

The BDS path corresponds with the BDS installation path in the Registry, but I decided to read it from the rsvars. Bat script, hoping it'll be more future-proof. So I'm essentially reading the .

Bat file into a TStringList and I'm applying a simple RegEx to identify the assignments. My routine that expands those $(Nam) style expressions includes a special case for the DELPHI name, to handle Delphi7: If I see that, I replace it with the installation path of the IDE.

1 Intereting, thanks. "I'm working on a bit of command line build automation (because I want to move away from Final Builder)" - wot you doing, wot you doing! Sounds interesting.

– Brian Frost Jul 29 at 10:28 1 I have tried to build my own little builder too at various points. I recommend just moving to Delphi 2007 or later, and using MSbuild. It's pretty decent.

– Warren P Jul 29 at 20:15 @Warren: Yes, I've found "CodeGear.Delphi. Targets" too in the bin folder which several users have modified. – Brian Frost Jul 31 at 6:26 @Warren, I need to support Delphi 7, 2010 and XE, and I'm aiming for something closer to Final Builder functionality (ie: everything from the actual Delphi build to uploading the finished installation KIT to our "beta" file server).

I've been using Final Builder for a looong time, but I always end up writing tiny console applications for all sorts of special functionality and then calling those from the FB script. This time I'm aiming at automating my scripts using dwscript (Delphi Web Script), I've got the actual Delphi builds going, putting the rest together is just a matter of time. – Cosmin Prund Jul 31 at 8:58.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions