When an application is linked with the link command, the default stack size is either 2K bytes or 4K bytes for most compilers and operating systems. This is usually enough for Vermont Views programs, but you may need to increase the stack size of you are encountering stack overflow problems.
The default stack size for an application compiled with Microsoft C is 2K (2048 bytes). The stack size is set during the link phase of application development with the /st option. To link a Vermont Views application that requires a 4K (4096 bytes) stack, the command would be:
|
Borland Turbo C sets the stack size during the compilation phase of application development. The default stack size is 4K (4096) bytes. Global variable _stklen sets and determines the stack size. To set the stack size to 8K (8192 bytes), include the following statement in one of the application's modules:
|
Because the statement sets the value of a global variable, the statement must be placed outside all function definitions. A good place to put it is at the top of the main module before main() is defined.
Note: The stack size is set during compilation, not when the application is run. Changing _stklen dynamically when the application is running will have no effect on the size of the stack.