Mail Archives: djgpp-workers/2004/08/11/14:05:58
> Date: Wed, 11 Aug 2004 08:19:59 -0400
> From: CBFalconer <cbfalconer AT yahoo DOT com>
>
> Just thinking out loud. That means that, within main only, and in
> the DJGPP stack environment, the system has to translate the word
> 'environ' to access the space for a third parameter to main.
No, I don't think so. The startup code calls `main' with 3 argument,
the 3rd being the addres of environ[0]. So a program that declares
`main' with 3 args will get the environment, and if it doesn't, it
won't. No magic translation is required.
> This is in the compiler proper. That access has to be removed if
> the -ansi directive is in force.
??? AFAIK, ANSI C does support the 3rd argument to `main'. So we
cannot remove it under -ansi.
> Thus the library proper is not affected, and can supply any names
> desired in either user or system space, provided they are in
> separate modules and not loaded unless specified. The whole thing
> is therefore a GCC bug, not a library bug.
No, the problem _is_ in the library (or, rather, in the startup code,
but that also belongs to the library). `environ' is defined in the
startup code (because it calls `main' with its pointer), and since the
startup code is _always_ linked into the program, the symbol is always
there, and it has an external linkage.
- Raw text -