Xref: utzoo comp.lang.c:23914 comp.sys.ibm.pc:38555 Path: utzoo!attcan!uunet!cs.utexas.edu!sun-barr!newstop!east!garp!var From: var@garp.East.Sun.COM (Var Garapetian, Sun-BOS Hardware [(508)671-0298]) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: Set stack size in TurboC Keywords: turbo-C Message-ID: <1058@east.East.Sun.COM> Date: 21 Nov 89 13:59:30 GMT References: <1004@east.East.Sun.COM> Sender: news@east.East.Sun.COM Reply-To: var@garp.East.Sun.COM (Var Garapetian, Sun-BOS Hardware (508)671-0298]) Followup-To: comp.lang.c Distribution: na Organization: Sun Microsystems, Billerica MA Lines: 40 >>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@East.Sun.Com GEnie: V.GARAPETIAN ============================================================================