16.9 The EXETYPE Statement

The EXETYPE statement specifies under which operating system the program is to run. This statement provides an additional degree of protection against the program's being run under an incorrect operating system.

Syntax

EXETYPE [[descriptor]]

Remarks

The descriptor sets the target operating system. EXETYPE sets bits in the header which can be checked by operating systems. The descriptor field can accept one of the following values:

WINDOWS [[version]]

The default. Creates a Windows program. If a STUB statement is not specified, WINDOWS changes the default message to one that is the same as is provided in WINSTUB.EXE. The version is optional; for a description, see the next section, “Windows Programming.”

DOS

Creates a nonsegmented executable file. This statement is not required for an overlaid DOS program; LINK assumes EXETYPE DOS. For information on creating an overlaid program, see Chapter 15. For information on how LINK determines the type of executable file, see “LINK Output Files”.

UNKNOWN

Creates a segmented executable file but sets no bits in the header.

Windows Programming

The WINDOWS descriptor takes an optional version number. Windows reads this number to determine the minimum version of Windows needed to load the application or DLL. For example, if 3.0 is specified, the resulting application or DLL can run under Windows versions 3.0 and higher. If version is not specified, the default is 3.0. The syntax for version is:

number[[.[[number]] ]]

where each number is a decimal integer.

In Windows programming, use the EXETYPE statement with a REALMODE statement to specify an application or DLL that runs under either real-mode or protected-mode Windows.

Example

The following statement combination defines an application that runs under Windows 3.0 in any mode:

EXETYPE WINDOWS 3.0

REALMODE