After hearing some good reviews about Pin DBI framework I have decided to give it a chance. I have downloaded the version for MSVC9 and tried to compile a sample project with MSVC9. That was the point where my problems started. Actually there is very minimal amount of information at the Pin website regarding using it with Microsoft Visual Studio (and the sample project file is pretty useless). Of course I have built the sample tools with "nmake" command successfully but I wanted to do the same straight from my MSVC. So I have spent line an hour (or two) fighting with massive numbers of compiler, linker (unresolved externals) errors until the build was done correctly. Surprisingly after running Pin with my PinTool it returned another error: "Pin 2.9 kit 39586E: Failed to load tool DLL. System error: Unknown error.". Well at this point I'm still not really sure what was wrong but after doing a lot of trial and error tests I have managed to create a MSVC configuration that actually works (at least for me). So here it is maybe someone will find it helpful. (Please note it may contain some redundant switches but it should be good enough for a start point.) For release configuration simply remove the "\DEBUG" switches.

So here are the steps:
"E:\pin" is the pin base directory.

Include directories:

Library directories:

Preprocessor Definitions

Compiler options:

Linker options:
/DLL /EXPORT:main /NODEFAULTLIB /NOLOGO /ENTRY:Ptrace_DllMainCRTStartup@12 ntdll-32.lib libxed.lib pin.lib pinvm.lib libcmt.lib libcpmt.lib /DEBUG

Who knows maybe this will work for you