I am trying to develop a Pintool on Windows. But so far I have been unable to configure or execute PIN. I have Microsoft Visual Studio 10.0 installed on my system. I have also downloaded and unzipped pin from its website.

On windows, "pin" command needs ".dll" file of pintool to execute. Suppose I want to execute "icount.cpp" on "prog1.exe". How can I do this?

How can I use Visual Studio to develop my own tools? I have gone through tutorials and I know what to writ, but I am not getting where and how to start?

Thanks you in advance.


The fastest and less cumbersome way I know is to make a copy of MyPinTool directory (under <pin dir>\source\tools\ and overwrite the file MyPinTool.cpp with your own code.

Open the MyPinTool.sln in Visual Studio and build your target. After that you can rename the DLL to whatever you want.

It is not an elegant solution but it gets the job done. In the end, you want to spent your time writing your PinTool and not annoyed with compiler specific settings...


I was able to find a blog which helped me configure Visual Studio 10 to develop my own tools. Here is the link to blog . The steps mentioned are generalized. But one thing I observed was that few directory names were different in my Pin installation. So please keep in mind to update those names. For some weird reasons I had to add "\LIBPATH:(path to additional library directories)" variable to Command Line Linker Options.

Also in the beginning of each cpp file mention

#define _SECURE_SCL 0

One common error you may face is "Error:LNK1104:Cannot open file* **". You can refer to this link to solve the issue.

EDIT: To execute the PIN tool:

Build the solution in Release configuration. I have extracted PIN inside my solution directory itself. Go to directory where pin.exe exists. Execute command in below format in command prompt:

pin -t [location (with file name) of solution DLL in release direcroty] -- [location (with file name) of application to execute]

Hope this will be helpful for anyone facing this issue in future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.