Date: Thu, 29 Feb 1996 13:13:28 +0200 (IST) From: Eli Zaretskii To: j DOT aldrich6 AT genie DOT com Cc: djgpp AT delorie DOT com Subject: Re: GDB discovers another one! In-Reply-To: <199602282348.AA196631316@relay1.geis.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 28 Feb 1996 j DOT aldrich6 AT genie DOT com wrote: > Question: If I stubedit the executable, but run it thru 'redir' or > 'gdb', does the program use its own stubedited values or those of > 'redir' and 'gdb'? I think I know the answer, but I want to be sure. Every program uses its own values, because each program gets its own stack. > But when I put it in the main header file for my program, I got the following > warning > in each of the program files: > > in file included with [file].c > merc.h: 1996: warning: '_stklen' initialized and declared extern > > Then, I got the following linker error, one for each program file: > > multiple definition of '_stklen' Don't put the line which enlarges `_stklen' in a header file included by more than one source file, because then you are initializing a global variable more than once, and the linker won't let you do this. Instead, include that line in a *single* source file. It's best to do this on the source file which defines the function that actually needs a large stack (that way, if you decide someday to make it part of a library, you won't get mysterious crashes), but any file will do. The warning that tells you that `_stklen' is both declared extern and initialized should go away if you remove `extern' from the declaration, like this: unsigned _stklen = ...