I am running BORLAND C++ at the command line under DOS. The problem
that I have is that the executables have a stack that is too small. In
reviwing the map file that the linker produces I can see that the stack
is too small. So, I neeed to increase the program stack size.
I have copies on the Borland documentation and have looked. I have
also looked through the options that the compiler and linker list at the
command line. The executable I am producing is running in real mode.
I'd appreciate any comments and suggestions.
Jonathan Hill
jmh...@ece.wpi.edu
Hello;
Here are some more details...
-- I am compiling using the large memory model
-- I am writing mixed code, combining assembly code and C code
-- I am using Borland C++ version 4.52 and Turbo Assembler version 4.0.
In looking about the Borland documentation I read that the large memory
model sets aside an entire segment for the large memory model. There is
a variable _stklen that can be used to adjust the stack size at run time
but this only works for small and medium models. Remember that the large
model sets aside an entire segment for the stack so there is no near heap.
Jonathan Hill
extern unsigned _stklen = 8192; /* 8K stack, default is 4K */
int main()
{
...
Using _stklen is valid for large memory model also.
In the following code fragment, you'll receive a
"Stack Overflow!" message if the line containing
_stklen is omitted, because the default stack size
is 4K.
You would need to use the -N option to enable
the compiler to emit code to do stack overflow
checking.
Compiled with: bcc -w4 -ml -N foo.c
--------------------------------------------------------------------------
#include <stdio.h>
extern unsigned int _stklen=16384;
void foo(void)
{
int data[3000]={0};
printf("in foo %d",data[0]);
}
int main(void)
{
foo();
return 0;
}
Jonathan M Hill <jmh...@ece.wpi.edu> wrote in message
news:8b8mbo$qd1$1...@bigboote.WPI.EDU...