[comp.sys.ibm.pc.programmer] How to modify _stklen in Turbo C 2.0

swie@cs.umn.edu (S. T. Tan) (05/07/90)

Could anybody tell me how to modify the stack size in Turbo C 2.0 ?
I get an error message "Stack Overflow!" when I run my program (NON-recursive).

Thanks in advance.
swie@umn-cs.cs.umn.edu

stever@Octopus.COM (Steve Resnick ) (05/08/90)

In article <1990May6.195629.6368@cs.umn.edu> swie@cs.umn.edu (S. T. Tan) writes:
>Could anybody tell me how to modify the stack size in Turbo C 2.0 ?
>I get an error message "Stack Overflow!" when I run my program (NON-recursive).
>

One of the things I dislike about the Turbo C runtime is that the stack is not
allocated based on the .EXE header. Instead, the variable _stklen is used to
determine the stack length. In one (only one) of your source files put a line

unsigned _stklen = <stack size in bytes> ;

This will cause a duplicate symbol warning by the linker but your new symbol 
takes precedence. BTW - This is buried somewhere in the TC manual. :)

Hope this helps...

--------------------------------------------------------------------------------
Steve Resnick -<stever@octopus.COM apple!octopus!stever sun!vsi1!octopus!stever>
408/241-1533 Process Scientific, Inc.
--------------------------------------------------------------------------------
"0x2B|~0x2B THAT is the question!"
My views are my own and in no way represent the views of
Octopus Enterprises or Process Scientific, Inc.
--------------------------------------------------------------------------------
Flames, Grammar, and SPELLING errors etc: >/dev/null
--------------------------------------------------------------------------------

stever@Octopus.COM (Steve Resnick ) (05/08/90)

BTW - Re my last post, the _stklen variable needs to be GLOBAL. 
Sorry.... :)

Steve

przemek@ndcvb.nd.cc.edu (Przemek Klosowski) (05/08/90)

It seems that you to overload library's variable with your own:
int _stklen = 8192; 
for example. You get the linker warning about double definition of _stklen
but that's OK.
	
--
			przemek klosowski (przemek@ndcva.cc.nd.edu)
			Physics Dept
			University of Notre Dame IN 46556