Documentation environment variables

Oct 18, 2008
339
2
Hello – I am not sure if this “how it works”

I been using tcc plugings for a since Version 10 – An I think this is the first time this happened. In the simplest form, it seemed that fetching environment variables seem not to have the most recent value.

Here is the case. I have a plugin that runs a scripting language ... When processing one of the scripts ( NOTE: that the plugin is running in the same process as TCC) the script loads a dll.
Code in that dll then tries to read a environment variable (say the name is FOO) that was set in the script. I checked the scripting language code and it calls the windows API to set the
variable.

Now in the loaded DLL, it tried to read the just set variable and its value is empty. I could not figure this out at all. I then tried the variable PATH. By the time this script runs, PATH has been modified by TCSTART.

Now I was tracking the loaded dll when it now acceded PATH and the value reported was not the value of path when the script started but I think the value when TCSTART started at start up – Did I miss something on how environment variables are save and processed? Thanks
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
The simple answer is that there's no way for that to happen -- TCC and plugins share the same environment.

If it *is* happening, then either the environment has been modified by the plugin or some other source (and the variable removed), or the plugin is deliberately choosing to use a different environment.

I need more information (and preferably a complete description of a reproducible failcase) to debug it any further.
 
Oct 18, 2008
339
2
The simple answer is that there's no way for that to happen -- TCC and plugins share the same environment.

If it *is* happening, then either the environment has been modified by the plugin or some other source (and the variable removed), or the plugin is deliberately choosing to use a different environment.

I need more information (and preferably a complete description of a reproducible failcase) to debug it any further.


I worked around the issue for now -- I will see what I can come up with .... so the api var calls in the plugin sdk for the most part "front-end" the win32 API calls?
 
Similar threads
Thread starter Title Forum Replies Date
Peter Murschall v27.00.16/17: ENDLOCAL with exporting variables wipes out the complete Environment Support 2
Charles Dye Read-only environment variables wiped by SETLOCAL / ENDLOCAL Support 5
J Shell nesting level, and inherited environment variables Support 10
fpefpe How to? Environment Variables changed Support 2
daniel347x How to get Take Command to read in all current system environment variables that CMD.EXE sees? Support 13
vefatica What environment variables does IDE need? Support 3
E Environment variables, set and input Support 2
T Is there a way to maintain the position in the environment list, while debugging? Support 10
D Unnecessary environment dependencies of TCC.EXE Support 3
T Portable Take Command installation for VDI environment Support 2
D v23 environment oddity Support 3
gschizas Take Command (Environment) doesn't show v2 ANSI colors Support 30
M Save the environment .. ;-) Support 2
J Set environment variable from stdout of command Support 3
nickles Passing a variable to a command w/o adding it to the local environment Support 7
vefatica Environment refresh? Support 0
rfaquino WAD Apparently a bug when expanding environment variable %ProgramFiles(x86) Support 2
B WAD environment variable in TCC.exe Support 2
SeoulBigChris Save Environment (Tabs) on Exit? Support 3
vefatica OT: Rex, how does CMD handle its environment? Support 0
M Updating environment variable from C++ fails erratically in version 14... Support 57
Frank problem with environment variable x86 vs. x64 Support 2
fpefpe volatile environment Support 5
D Environment in elevated process Support 1
Peter Bratton IDE environment window display Support 0
D Environment variable oddity Support 12
vefatica Got IDE's environment tab back Support 0
S blanks in environment variable paths Support 4
tinjaw Looking for best practice for custom environment on tabs Support 0
E Environment variable in tcmd.ini Support 14
I Environment variable in OPTION screen? Support 2
J trouble redirecting output to environment variable Support 7
S How to? best way to compose data for command to use out of presets/variables Support 1
Joe Caverly START Dialog usage of %_ variables Support 0
Joe Caverly Modified Variables in CMDebug/BDebugger Support 1
T How to? Show the values of batch variables on the TCC screen Support 21
J Escaped Characters and Variables Support 2
M Keywords for commands, functions, internal variables Support 3
D How to? How to show variables expanded in the log tab Support 3
U Variables _IFTP, _IFTPS: what about sftp connections? Support 2
M Verification re volatile variables... Support 41
Stefano Piccardi 14.01.33 unset doesn't complain about undefined variables Support 8
CWBillow Variables in shortcuts? Support 15
Frank WAD handling variables with $-prefix Support 14
cgunhouse Accessing variables set using SET /U or SET /S Support 3
G gosub variables Support 9
vefatica Leading spaces in array variables Support 13

Similar threads