Share via


Creating Verbose Linker Information

When you build a target, it is common to have questions similar to those in the following list:

  • Why did the linker pull in function Xxx from that object?

  • Why did the linker use function Yyy from library B instead of from library A?

  • Why was function Zzz not included in the final image?

  • What libraries are searched to produce this image?

  • What switches and objects are in the image?

You can use the VERBOSE linker option to help find the answers to these questions. You can enable this flag by setting the LINKER_FLAGS macro in your Sources file. For an example, see the following code:

LINKER_FLAGS=$(LINKER_FLAGS) /VERBOSE

You can also set the VERBOSE linker option from the WDK build environment by running the following command line:

set LINKER_FLAGS=$(LINKER_FLAGS) /VERBOSE

The output that is produced by using this linker option is written to the build log. For more information about these log files, see Using Log Files.

The following example shows an excerpt from a build log for the Toaster sample in the src\general\toaster directory of the Windows Driver Kit (WDK). The Toaster sample was built with the VERBOSE linker output enabled:

Searching C:\WinDDK\7063.0\lib\win7\i386\ntoskrnl.lib:
1> Found _memset
1> Referenced in toaster.obj
1> Referenced in wmi.obj
1> Loaded ntoskrnl.lib(ntoskrnl.exe)
1> Found _memcpy
1> Referenced in wmi.obj
1> Loaded ntoskrnl.lib(ntoskrnl.exe)
1> Found __imp__ExFreePoolWithTag@8
1> Referenced in wmi.obj
1> Loaded ntoskrnl.lib(ntoskrnl.exe)
1> Found __imp__IoWMIWriteEvent@4
1> Referenced in wmi.obj
1> Loaded ntoskrnl.lib(ntoskrnl.exe)
1> Found __imp__KeQuerySystemTime@4
1> Referenced in wmi.obj
1> Loaded ntoskrnl.lib(ntoskrnl.exe)
1> Found __imp__ExAllocatePoolWithTag@12
1> Referenced in wmi.obj
1> Loaded ntoskrnl.lib(ntoskrnl.exe)

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011