Set stack size in TurboC
Var Garapetian, Sun-BOS Hardware [508671-0298]
var at garp.East.Sun.COM
Wed Nov 22 00:59:30 AEST 1989
>>Could someone tell me how or direct me to where in the documentation I can
>>find the way to increase the "stack size" in Turbo-C?
>>I am not an expert in C and am using the integrated environment for my
>>programs. I have my compiler set to COMPACT model. A programm I am
>>working on, was causing bizzare behaviour, so I turned the "Stack Overflow"
>>warning on. This indeed showd I was having stack problem.
>>I have been through the TC manuals and have found the _stklen variable which
>>sets the stack size, however don't know how to set it to a larger size.
>>If I type the following before main():
>> extern unsigned _stklen=6144;
>>It seems to set the stack to a larger value, but the linker gives the
>>following warning:
>> __stklen defined in module GPX.C is duplicated in module STKLEN
>>Any help will be very much appriciated...
Thanks to all of you that replied. Most replies seemed to point out that my
original approach was right, so I went back and poked a bit and found out
previous stack overflows had some how corrupted a couple of data files which
caused me to think the above didn't enlarge the stack.
To make sure, I called Borland too and they gave me the same answer.
So to sum it up:
To extend the size of stack, put the following line before main() and ignore
the linker warning!
extern unsigned _stklen=nnnn; /* nnnn= required stack size. */
Thanks again to all those who replied.
-var.
============================================================================
Var Garapetian, Sun Microsystems, East-Coast Div.
UUCP: {hplabs,ihnp4,ucbvax,decvax,seismo}!sun!vgarapetian
or {decvax}!eagle_snax!garp!var
INTERNET: vgarapetian at East.Sun.Com
GEnie: V.GARAPETIAN
============================================================================
More information about the Comp.lang.c
mailing list