Turbo-C stack problem

unicorn at uxh.cso.uiuc.edu unicorn at uxh.cso.uiuc.edu
Fri Jul 20 12:28:00 AEST 1990


Andy,

  I had a similiar problem once also, but I was able to reduce other memory
use so I didn't have to change the stack size.  This may totaly off-base,
but here is what i think is going on.

  The stack size is set by the program, not by the compiler.  The compiler
sets up the memory size and usage.  It only defines the top of the stack,
not the bottom.  The variable _stklen is used by the initiating code to
calculate the pointer where the end of stack is at.  So I think! that
it just needs something like,

#define STACKSIZE 10240

extern unsigned _stklen = STACKSIZE;

main()
{
.
.
.
}


  I never actually tried this, but it kind of makes sense (I hope!).
Since _stklen becomes a public symbol after compilation, the initiating
code can easily look at it in the data segment.

I hope that this helps (and works!!).  Let me know if you learn anything
else about this.

Harry E. Miller
unicorn at uxh.cso.uiuc.edu
Smile! - The Unicorn is watching you!!



More information about the Comp.lang.c mailing list