Intel® Thread Checker for Windows* - Preparing Your Software: Building or Making Source Code

Page Contents:


Tips on Preparing Microsoft Windows* Code for Intel® Thread Checker
The following are general tips for preparing Windows* source code for Intel® Thread Checker. Build (make) your source with the following switches:

  • Be sure to build thread-safe by compiling with the /MD, /MDd, /MT or /MTd switch. This will use the thread-safe run-time libraries.

    Note: The default for Microsoft* and Intel® Compilers is the /ML or /MLd switch and this does not use thread-safe libraries.

  • Generate symbols by compiling with the /Zi, /ZI or /Z7 switches and link with the /DEBUG switch. This will enable Thread Checker to specify source code information (file name and line number) with its diagnostics.

  • Compile without optimization using the /Od switch. Just like when using a debugger, this will enable Thread Checker source code information (especially line numbers) to be accurate. Moreover, turning on compiler optimizations is usually not beneficial for code run under Intel Thread Checker.

  • Executable software must be built so that it contains a relocation section that allows for relocation in memory. Relocation is required for instrumentation. Most dynamic-link library (.dll) files can be relocated by default; however by default, most executable (.exe) files cannot be relocated. So always link with the /FIXED:NO switch to allow for relocation.

    Tip: Instead of changing your project's settings, set the (system) environment variable LINK to the value /FIXED:NO and re-link your code to add a relocation section.

  • To reduce executable (.dll or .exe) code size, link with the /INCREMENTAL:NO switch.

Intel® Thread Checker Run-Time Warnings for Microsoft Windows* Applications
If you get the warning "modules were created without base relocations" when you run Intel® Thread Checker activity in the VTune™ environment or Microsoft .NET* Development Environment, your code probably doesn't contain a relocation section. Link with the /FIXED:NO switch to add a relocation section.

I don't have source code. Can I use Intel® Thread Checker?
Yes -- But on Microsoft Windows*, do not expect to get any threading diagnostics for the application (.exe) file itself b ecause typically on Windows the executable does not have a relocation section.

An example of using Thread Checker without source code might be if you are using an application file from another vendor, so you don't have source code for the for the application. But you are interested in diagnostics about a dynamic or shared library file that is loaded by the vendor's .application. You may not even have source code for the library that gets loaded. You can still use Thread Checker to see if any threading diagnostics are detected. Of course, if you really want to correct threading issues, you'll need source code.

For more complete information about compiler optimizations, see our Optimization Notice.