previous next top complete contents complete index framed top this page unframed
The Windows NT linker allows you to specify at link-time the maximum
size of a program's system stack. By default, the maximum system
stack size is 1 Mb on Windows NT 4.0. To specify a different
maximum stack size, specify the link command switch
/STACK:nnn,
where nnn is the maximum stack size in bytes.
By default, nnn is
assumed to be a decimal number; if its first two characters are
0x, it is assumed to be a hexadecimal value. For example,
the switch
/STACK:0x400000 specifies a maximum stack size of 4 Mb. For more
information, consult the appropriate Microsoft documentation.
3.1. STACKSIZE on NTPNT
On NTPNT, the STACKSIZE configuration parameter
affects the stack size only of coroutines created after
the initial coroutine; the system
stack is used for the initial coroutine.
3.2. NTPNT-Specific CONF Commands
In addition to the target-independent commands described in
Chapter 6 of the MAINSAIL Utilities User's Guide,
the NTPNT version of CONF provides the following
additional commands:
3.2.1. INITIALWORKINGDIR s
The parameter s is a STRING,
the name of the directory to which MAINSAIL
connects.
If the WINBITS bit '2 is set, then as a part of its initialization, MAINSAIL calls the system function SetCurrentDirectory. If INITIALWORKINGDIR is not the empty STRING, MAINSAIL uses it as the argument to SetCurrentDirectory. Otherwise, MAINSAIL uses the current user's home directory, as given by the concatenation of the environment variables HOMEDRIVE and HOMEPATH.
If the WINBITS bit '2 is not set,
then MAINSAIL does not call
SetCurrentDirectory. The initial working
directory is established by the
Working Directory property in the bootstrap file itself (for a
Windows-based application) or by the current working directory of the
shell in the Command Prompt window (for a character-based application).
3.2.2. VIRTUALALLOCMEMSIZE li
The LONG INTEGER
parameter li is the number of bytes to reserve whenever
MAINSAIL allocates virtual memory.
MAINSAIL memory allocation on Windows takes place in two steps: first, MAINSAIL reserves a block of virtual memory. This block can be much larger than the amount of physical memory available on the machine; the only purpose of reserving it is to ensure that when memory is allocated later (presumably in smaller amounts), the allocated memory is contiguous, at least within a region of memory of the size specified. Later, the memory is actually allocated (in Windows terms, it is said that you commit the memory allocation) from within the reserved block.
VIRTUALALLOCMEMSIZE affects only the amount reserved for later
commitment. Because MAINSAIL memory management algorithms work best
with contiguous memory, VIRTUALALLOCMEMSIZE should be quite large.
However, it should not be the entire
address space, or foreign code
linked with MAINSAIL (e.g., operating system runtime support routines)
will not be able to reserve memory. The default value for
VIRTUALALLOCMEMSIZE is 256 Mb.
3.2.3. WINBITS b
The BITS parameter b can have
three bits set in it, '1, '2, and '4:
The CONF command WIN32BITS is a synonym for WINBITS.
3.3. Linking a Bootstrap for NTPNT
A MAINSAIL bootstrap can be either a Windows-based application or a
character-based application. The assembly step is the same for each,
but the linkage step is different.
Be careful that the linkage method you follow agree with the setting of the CONF WINBITS parameter. That is, if WINBITS specifies a Window-based bootstrap, do not follow the linkage instructions for a character-based bootstrap, or vice versa. If you link the bootstrap improperly, the resulting .exe file will not run, and may be unable to display a sensible error message.
The output from CONF is an assembly language file with the file name extension .s. In the examples below, mainsa.s is used as the CONF output file name, and mainsa.exe as the executable bootstrap name; if you choose a different name, substitute accordingly.
The Command Prompt window command to assemble the output file from CONF is:
C:\MYDIR>ml /c /coff mainsa.s<eol>
The result is a file called mainsa.obj.
The assembler you should use is Microsoft Macro Assembler (MASM) version 6.11 or later; XIDAK has not tested the assembly step using any other assembler.
Regardless of whether you create a Windows-based or character-based application, you must use a 32-bit linker. XIDAK has used the linker shipped with Microsoft Visual C++ Development System for Windows and Windows NT, version 5.0 or later.
where userapp.obj is the foreign code to be linked with MAINSAIL
(see Section 9.5 for more about $foreignCodeStartsExecution).
where userapp.obj is the foreign code to be linked with MAINSAIL
(see Section 9.5 for more about $foreignCodeStartsExecution).
3.3.1. Linking a Bootstrap
The Windows linker can accept arguments of the form
@fileName, where
fileName specifies a file
that contains additional linker arguments.
The MAINSAIL installation script creates text files,
the bootstrap-making command files, that contain
the additional linker arguments required to make various kinds of
MAINSAIL bootstraps. This simplifies the bootstrap-making process on
Windows because you need specify only one
argument to pick up all of the supporting files for the MAINSAIL
bootstrap. Following is a description of the bootstrap-making
command files created by the
MAINSAIL installation script;
it assumes that the bootstrap you are making is
named mainsa.exe and that you are making it from CONF output
mainsa.obj and, where applicable, foreign code
userapp.obj:
link -out:mainsa.exe mainsa.obj @c:\mainsail\16.30.1\m.txt
link -out:mainsa.exe userapp.obj mainsa.obj @c:\mainsail\16.30.1\f.txt
link -out:mainsa.exe mainsa.obj @c:\mainsail\16.30.1\mc.txt
link -out:mainsa.exe userapp.obj mainsa.obj @c:\mainsail\16.30.1\fc.txt
MAINSAIL System-Specific User's Guides, Chapter 3