According to Pismo:
I've run into some strange behavior accessing environment variables using GPC. Accessing certain environment variables before others appears to clear the value of others returning an empty value. By shuffling the order that the following variables are accessed returns all of the values.
Which version of the "System" unit are you using? Maybe its `GetEnv' is broken and modifies the environment variables.
It is probably best if you post the source of your `GetEnv' function here.
It's the GetEnv that came in the BPCOMPAT unit.
Yes, of course. :-I There are three versions of it ...
Okay, I checked all their `GetEnv's, and they all seem okay for me.
If you are in hurry and just want to get rid of the error, you can try and upgrade your GPC and your BPcompat library at ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/beta/ and ftp://agnes.dida.physik.uni-essen.de/gnu-pascal/contrib/.
If you want this bug really be fixed, you can help us by examining what happens to your `Gpc_envp' variable while your program calls `GetEnv'. This variable holds the address of an array of C-style strings - pointers to zero-terminated arrays of characters.
* Declare it as a pointer to an array of CStrings.
Type CStrArray = array [ 0..42 ] of __CString__; CStrArrayPtr = ^CStrArray;
Var EnvP: __AsmName__ 'Gpc_envp' CStrArrayPtr;
* While your program calls `GetEnv', examine the contents of this array - both the addresses and the values pointed to. Either use a debugger or additional `writeln' statements ... well, you know ...
Good luck,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [971005] maintainer GNU Pascal [971001] - http://home.pages.de/~gnu-pascal/ [971005]