Pass 2

In Pass 2 of the build process, the Build utility links objects and libraries into final binaries.

During Pass 2, the Build utility starts the NMAKE utility within any leaf directory that requires final binaries to be created. NMAKE might call the following tools during Pass 2:

  • The Linker utility (Link.exe).

  • The Resource compiler (Rc.exe).

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

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

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

TARGETTYPE value in Sources file Description Files input to Pass 2 Files created during Pass 2

DYNLINK

Dynamic link library or user-mode driver

obj,.res,.lib

.dll

DRIVER

Kernel-mode driver

obj,.res,.lib

.sys

PROGRAM

User-mode application

obj,.res,.lib

.exe

 

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

1>Linking for c:\winddk\7063.0\src\hid\firefly\driver *************
1>'nmake.exe /nologo BUILDMSG=Stop. -i BUILD_PASS=PASS2 LINKONLY=1 NOPASS0=1 MAKEDIR_RELATIVE_TO_BASEDIR=src\hid\firefly\driver'
1>BUILDMSG: Processing c:\winddk\7063.0\src\hid\firefly\driver
1> C:\WinDDK\7063.0\Bin\x86\oacr\oacrlink /out:c:\winddk\7063.0\src\hid\firefly\driver\objfre_win7_x86\i386\firefly.sys /machine:ix86 @c:\winddk\7063.0\src\hid\firefly\driver\objfre_win7_x86\i386\lnk.rsp
1>Microsoft (R) Incremental Linker Version 9.00.30729.207
1>Copyright (C) Microsoft.  All rights reserved.
1>/MERGE:_PAGE=PAGE 
1>/MERGE:_TEXT=.text 
1>/SECTION:INIT,d 
1>/out:c:\winddk\7063.0\src\hid\firefly\driver\objfre_win7_x86\i386\firefly.sys 
1>c:\winddk\7063.0\src\hid\firefly\driver\objfre_win7_x86\i386\firefly.res 
1>c:\winddk\7063.0\src\hid\firefly\driver\objfre_win7_x86\i386\driver.obj 
1>c:\winddk\7063.0\src\hid\firefly\driver\objfre_win7_x86\i386\device.obj 
1>c:\winddk\7063.0\src\hid\firefly\driver\objfre_win7_x86\i386\wmi.obj 
1>c:\winddk\7063.0\src\hid\firefly\driver\objfre_win7_x86\i386\vfeature.obj 
1>C:\WinDDK\7063.0\lib\win7\i386\BufferOverflowK.lib 
1>C:\WinDDK\7063.0\lib\win7\i386\ntoskrnl.lib 
1>C:\WinDDK\7063.0\lib\win7\i386\hal.lib 
1>C:\WinDDK\7063.0\lib\win7\i386\wmilib.lib 
1>C:\WinDDK\7063.0\lib\wdf\kmdf\i386\1.9\WdfLdr.lib 
1>C:\WinDDK\7063.0\lib\wdf\kmdf\i386\1.9\WdfDriverEntry.lib 
1>C:\WinDDK\7063.0\lib\win7\i386\hidparse.lib 

This example illustrates the following points:

  • The Build utility calls NMAKE on Processor 1 and specifies that the BUILD_PASS is PASS2 and the directory is driver.

  • NMAKE calls the OACR wrapper (Oacrcl.exe). This, in turn, starts the linker to generate the driver binary. The /out parameter specifies the output file name for the generated binary.

When the Build utility completes all the Pass 2 tasks for the project source tree, the build process is complete.

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011