Altering the Stack Size

Product Version(s): 3.3x
Operating System:   MS-DOS
Flags: ENDUSER |
Last Modified: 26-SEP-1988    ArticleIdent: Q10377

Question:

How can I adjust the size of a program's run-time stack with Pascal
Version 3.3x?

Response:

You may use the /STACK linker option using the following command:

link /STACK:<number> <object_file_name>;

The <number> will be the decimal number of bytes for the size of the
program's stack; <number> should be greater than 0 and less than
64,000.

Try to keep the stack size between 2000 and 30,000 bytes. A stack of
64,000 could interfere with near-heap allocation, which also occurs in
the same 64K default data segment. (The note of warning in the
"Microsoft Pascal Compiler User's Guide" concerning the /STACK linker
switch applied to Pascal Version 3.20, and is no longer a problem in
Versions 3.3x.)

Alternately, the EXEMOD utility can be used to change the stack
size of a program after it has been linked, as in the following:

exemod <exe_name> /stack <hex_number>

The <exe_name> is the name of your executable file; <hex_number>
specifies the hexadecimal number of bytes in the stack.
