Mail Archives: cygwin/2006/03/28/04:57:24
Martine Carannante wrote:
> Does that mean it is impossible to set environment variables once the
> program is started ? In that case; the setenv/putenv are not equivalent
> to UNIX functions.
No, of course you can set environment variables using getenv/putenv.
They should work just as expected. But the point is that by the time
your code makes any of these changes to the environment, the Cygwin DLL
has already initialized itself and read the contents of the $CYGWIN
variable so it is too late for any changes to matter. Of course if you
set the variable and then spawn a child process, it should get the
updated version of the variable, and in that case it would be set in
time to matter.
But to me it seems far easier to just set the variable once at the "top
level" (through the control panel) and then it will be set everywhere,
globally, for all processes, without any further action. If you do it
any other way you have to worry about setting the value and then passing
it on to a child process.
Brian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -