Use the /Mq compiler option with CL.EXE to compile a QuickWin program from the DOS command line. The /Mq option has the following effects:
The _WINDOWS constant is defined using the /D compiler option, causing the QuickWin constants and functions defined in IO.H and other include files to be compiled.
The linker is invoked with the libraries xLIBCyWQ and LIBW, where x = S, M, C, or L, specifying the memory model used (determined by other compiler options) and y = E or A, specifying the floating point model used. (S, M, C, and L stand for Small, Medium, Compact, and Large, respectively. E and A specify how the compiler does floating-point math in your program: with an alternate math library (A) or with either a math coprocessor chip or an emulator library (E).) If you specify only /Mq, the default memory and math models for your programming environment are used. QuickWin supports the same models as other Windows .EXEs. You can also use the /A and /FP options to specify different models. (Windows 3.x does not support the tiny model.)
If no other .DEF file is given, QuickWin uses the default .DEF file, CL.DEF. Every Windows program needs a module definition file (.DEF file) to define its name, segments, memory requirements, and exported functions. (See the Microsoft Windows Software Development Kit Guide to Programming for more information about module definition files.) CL.DEF provides reasonable defaults for a Windows application. In particular, CL.DEF specifies PROTMODE, which tells the linker to mark the application for execution in Windows standard or enhanced mode, and sets HEAPSIZE to 1024 bytes and STACKSIZE to 8096 bytes. You may want to provide your own .DEF file to change HEAPSIZE or STACKSIZE, but you are unlikely to need to redefine any of CL.DEF's other default values.
You can specify other options, filenames, and libraries in the command line as well, depending on your program's needs. To build a QuickWin C or C++ application, the compiler must have access to the module-definition file CL.DEF. Make sure this file is in the same directory as CL.EXE. In addition, the program WINSTUB.EXE must be in the current directory or in a directory listed in PATH. (WINSTUB displays the message “This program requires Microsoft Windows” if an attempt is made to run a QuickWin program from the DOS command line.)
The program QWHELLO.C, supplied on the distribution disks, can be compiled to run under either DOS or Windows, depending on the compiler options you choose. This is because it contains no enhanced QuickWin features. The following command compiles QWHELLO.C as a QuickWin program:
CL /Mq QWHELLO.C
You can immediately run the resulting program, QWHELLO.EXE, in Windows. QWHELLO writes the text “Hello, Windows!” in the standard output window. For instructions on starting the program, see “Running QuickWin Programs”.