What is the use of System Environment Variables? - environment-variables

I am the beginner for visual studio IDE. While I was assigned the project in the Visual studio IDE. I was asked to create system environment variable as ACE for ACE Lib files. Could any one please tell me why we configuring the system environment variable. What they actually mean ?
My doubt is what is environment variable ?
How it communicate with the IDE ? Why it is so important to setup environment variable ?
(Please correct me If I got anything wrong here)

Do you need to change the path stored in EnvironmentVariable, some thing like this,
http://www.computerhope.com/issues/ch000549.htm
or else you need to Create, modifie, or delete an environment variable stored in the current process,
https://msdn.microsoft.com/en-us/library/z46c489x(v=vs.110).aspx
Adding more details in your question might be helpful.

Related

Delphi XE2 host application from output directory

Is there a way to tell a Delphi project that builds a DLL to use as a host application an executable in the same directory as the output directory of the DLL being built?
something like this:
One thing is, I'm using option sets with Delphi XE2, so in the dproj for the DLL I'm building I don't even have a DCC_ExeOutput directory, not sure if that matters.
Allowing this would seriously decomplicate some issues we've ran into trying to migrate from VSS to SVN.
Also, what do you call the $(thing)'s?
The $(name) things are environment variables. I tried setting the host application to .\$(Platform)\$(Config)\Test.exe and received this error message:
Could not find program, '.\%Platform%\%Config%\Test.exe'.
Note how the $(...) was turned into environment variable syntax.
I also tried with $(systemdrive)\Test.exe and received this error message:
Could not find program, 'C:\Test.exe'.
So clearly environment variables will be substituted with their values, if they do exist. I think it is reasonable to conclude that the environment used to start a host application clearly does not define the special Delphi specific environment variables.
So I think the answer to your question is that you cannot use indirection like this for the host application setting.
On the other hand, environment variables are substituted so perhaps you could use that to make things easier. In other words you could define some environment variables of your own. I've no idea whether that may be of help to you since I don't know the precise details of your problem.

e-text editor or textmate: What are environmental variables? or in e-text: environment - KEY_____ VALUE_____

I'm sure this has to do with programming/coding, in e-text editor, under edit>settings, there's a tab called "environment", when clicked on you see 2 columns, the left if titled KEY, and the right is titled VALUE. I Googled it and I think it might be the equivalent of textmate's Environment Variables, here's their wikipedia page that shows a screenshot. I just don't understand what 'Project Specific Environment Variables' are, and what you would use them for, an example? How would I use this?
I'm pretty sure this will be an acceptable question for stackoverflow, if not, then I apologize.
I just don't understand what 'Project Specific Environment Variables' are, and what you would use them for
Most command line compiler tools uses environment varibales to control the compile and build process.
For example INCLUDE, LIB and LIBPATH are typical environment variables used by Windows based C/C++ command line compilers.
[give] an example?
Take for example the Microsoft C/C++ compiler. To run this compiler from the command line you need to setup a larger number of environment variables.
Infact this enter code herecompile needs so many environment variables, Microsoft even provides the vsvars32.bat file which does nothing more than correctly setup the environment variables.

dcc32: environment variables in *.cfg

I'm trying to build a simple release build batch for our app. I'd like to use environment variables inside the <AppName>.cfg file. However these seem not to get expanded. Neither
-U"$(DELPHIKOMP)\VclZip;..."
nor
-U"%DELPHIKOMP%\VclZip;..."
work. However
-U"C:\DelphiKomp\VclZip;..."
does. Any idea what I'm doing wrong?
Please note: We're using BDS2006, so MSBuild is no option for now.
Update: As gabr suggested I wrote a little tool that expands the environment variables in my cfg and calls dcc32 for me. Thanks to all for their answers!
DCC32 doesn't support expansion of environment variables.
I'm pretty sure there exists a utility on the Internet which expands all variables in the cfg file, calls dcc32.exe and restores original cfg file, but I can't locate it anymore.
You can write such program pretty easily by yourself, though.
Why not pass them as command line parameters to dcc32 - in that case the shell will expand them.
FWIW, using Delphi 2006 does not preclude MSBuild, or make, or another build tool; just shell out to dcc32 as necessary.

Delphi app calling cobol app -> error

We need to get data out of an older accounting system. We have received a dll that gives us access to the data we need. It includes a type library that we have imported.
If we run our test application from the same directory as the accounting system, everything works fine. If we try to run our application from a different directory, we get the following error:
Dynamically Bound RTS
Runtime DLL 'OOPS', version 3.1, entry point oops
not recorded in registry, not found or incompatible with requirements
of dynamically bound COBOL program. Dynamic binding of RTS requires:
Runtime DLL 'OOLSM', at least Version 3.1
Can anybody provide some helpful information on this?
Are we supposed to have some kind of cobol runtime in our directory? Or in the path? Or registered in the registry?
Thanks,
-Vegar
Updates:
Setting the system %path% to include the path to the accounting system seems to do the trick. Including it as a user variable did not have the same effect for some reason.
What Cobol are you using?
I had done this for year with Microfocus NetExpress 3.1, and all works just fine.
I write COBOL DLL to access COBOL data files, and also write Delphi DLL to add new features to old COBOL systens.
And yes, I use to set the runtime path, that is environment variable called COBDIR, there are others,but usually %PATH% and %COBDIR%is enough.
If you give more detais about what COBOL compiler are you using, and how is the dll interface that you are calling, will me ore easy to help you.
And maybe "Dependence Walker" can help you to identify what run time files are missing, if it is.
http://www.dependencywalker.com/
If it works from the accounting app's directory, but not a different one, the first thing I'd try is adding that directory to your path.
Unless it is already loaded into memory, Windows looks for DLL's that a program is requesting in every location listed in its PATH environment variable, and also in the directory the application is located within.

Changing CURRENT save/default directory in Delphi 2007 without using Save-As

I have a project group that contains a project I'm working on as well as some related component and packages. I prefer to keep the database links active during design-time.
I know how to write the code which would change the database file location, but in this case, I'm just using ".\data" instead, for various design-time reasons. Unfortunately, using a relative folder means that Delphi needs to be "pointing" to the same folder that the project is in.
I'd like to be able to force the folder location to a different root, without using the "Save As" feature. Does anyone happen to know where the Delphi IDE retrieves that info?
I have some projects in delphi7, Delphi2009, Delphi2010 and DelphiXE4 and also my project are not stored in my document.
I force the save/default like this:
Tools > Options > Environment Options > Default project
for Delphi 2010 => U:\Projects\Rad Studio 2010\Projects
I am not sure I completely understand your question.
If you are referring to the folder the IDE has as the current folder, then you can just change the shortcut that launches Delphi to set the current directory where ever you want it to be.
You can change the location the project compliers and saves the dcu/unit/exe to in Project/Options under the Directories/Conditionals is that what you are looking for?
I bevile there is also some settings for the DBE in the Tools menu, but I dont have them install at the moment (or i cant find them)
I'd say you should just hard-code the full path to the database. Not pretty, but it will always work. There are tools, like GExperts, that will ensure your database components are set to inactive when you save them, and that way you can be sure to set them correctly on the live computer at runtime.
It would be nice to use relative paths, but that would be a function of the component and not the application really.
Do NOT use a path relative to .exe path. That will get you into trouble with Windows XP in limited access mode, as well as with Windows Vista.
Do you need one database for all users?
Use a path relative to All Users\Application Data directory.
Do you need separate databases per user?
Use a path relative to user's private User\Application Data directory.
Do you need multiple databases per user?
Use a path relative to user's My Documents directory.
Use any of the above as default, but add registry keys that allow you to override the settings.
I believe it gets that info from Tools -> Options -> Environment Options -> Environment Variables.
Try to play with those (Add override).
Tools -> Options -> Environment Options -> Environment Variables - BDSProjectsDir

Resources