To compile Windows applications, you use Microsoft C Optimizing Compiler (CL), just as you do for standard C applications. You can use many of the same CL command-line options you use for standard C applications. However, Windows also requires two special options: /Gw and /Zp. The /Gw option adds the Windows prolog and epilog code to each function; this code is required for the application to run with Windows. The /Zp option packs structures, ensuring that the structures used in your application are the same size as the corresponding structures used by Windows. Following is a typical CL command for compiling a small-model Windows application:
cl /c /AS /Gsw /Os /Zdp test.c
The /c option instructs the compiler to perform only the C compilation, but not the linking. The /c option is necessary if you want to compile multiple C source files separately.