Pass 1

In Pass 1 of the build process, the Build utility compiles source code into object (.obj), resource (.res), and library (.lib) files.

During Pass 1, the Build utility starts the NMAKE utility within any leaf directory that requires object, resource, or library files to be created. If a Sources file contains the PRECOMPILED_INCLUDE macro, precompiled header files (.h) will be built during Pass 1.

The NMAKE utility might start the following tools during Pass 1:

  • The C/C++ compiler (Cl.exe).

  • The Resource compiler (Rc.exe).

  • The Managed Object Format (MOF) compiler (Mofcomp.exe).

  • The Binplace utility (binplace.exe), which puts files that are created during Pass 1.

    The Build utility starts BinPlace during Pass 1 if you specify the PASS1_BINPLACE macro in a Sources file.

The compiler might also be called through the Windows Auto Code Review (OACR) wrapper (Oacrcl.exe).

The Build utility starts NMAKE to start the C/C++ compiler to perform the following tasks:

  1. The compiler first builds precompiled headers if PRECOMPILED_INCLUDE macro is specified in the Sources file.

  2. The compiler compiles C and C++ source files into object files.

  3. If the Sources file sets the TARGETTYPE macro to LIBRARY or DYNLINK, the compiler will also create a library file from the compiled object files.

The types of files that are built during Pass 1 are shown in the following table.

TARGETTYPE value in Sources file Description Files types input to Pass 1 Files created during Pass 1 Is target complete after Pass 1?

LIBRARY

Static library

.h,.c,.hpp,.cpp,.rc,.mc

.obj,.res,.lib

Yes

DYNLINK

Dynamic link library or user-mode driver

.h,.c,.hpp,.cpp,.rc,.mc

.obj,.res,.lib

(import library)

No

DRIVER

Kernel-mode driver

.h,.c,.hpp,.cpp,.rc,.mc

.obj,.res

No

PROGRAM

User-mode program

.h,.c,.hpp,.cpp,.rc,.mc

.obj,.res

No

 

By default, the build log is stored in the working leaf directory where the Sources file resides. The following example shows the Pass 1 output from a build log:

BUILD: Examining c:\winddk\7063.0\src\hid\firefly directory tree for files to compile. (2nd Pass)

1>Compiling (NoSync) c:\winddk\7063.0\src\hid\firefly\driver *************
1>'nmake.exe /nologo BUILDMSG=Stop. -i BUILD_PASS=PASS1 NOLINK=1 PASS1_NOLIB=1 MAKEDIR_RELATIVE_TO_BASEDIR=src\hid\firefly\driver'
1>BUILDMSG: Processing c:\winddk\7063.0\src\hid\firefly\driver
1>Copyright (C) Microsoft.  All rights reserved.
1> C:\WinDDK\7063.0\Bin\x86\oacr\oacrcl @c:\winddk\7063.0\src\hid\firefly\driver\objfre_win7_x86\i386\cl.rsp
1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.207 for 80x86
1>Copyright (C) Microsoft.  All rights reserved.
1>cl /Fo"c:\winddk\7063.0\src\hid\firefly\driver\objfre_win7_x86\i386/"
1> /FC
1> /wd4627
1> /typedil-
1> /FIC:\WinDDK\7063.0\inc\api\warning.h
1> .\driver.c .\device.c .\wmi.c .\vfeature.c 
1>driver.c
1>device.c
1>wmi.c
1>vfeature.c

This example illustrates the following points:

  • The Build utility starts NMAKE in thread 1 and specifies that the BUILD_PASS is PASS1 and the directory is driver.

  • NMAKE calls the OACR wrapper (Oacrcl.exe). This, in turn, starts the C/C++ compiler (Cl.exe).

When the Build utility completes all the Pass 1 tasks for the project source tree, it does one of the following:

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011