Building HPM Plugin for MSVC

From Hercules Wiki
Revision as of 20:19, 2 May 2013 by Ind (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is a guide on how to prepare your MSVC environment for a new HPM plugin.

Guide

  1. Go to src/plugins/ folder, create a new .c file, e.g. sample2.c (this name will be used throughout this guide)
  2. Open your MSVC project (e.g. 'Hercules-9.sln)
  3. Go to the Solution Explorer
  4. Right click the Hercules project (first item in Solution Explorer), and click Add->New Project
  5. Select General, and pick Empty Project.
  6. Enter the name of your plugin in the Name field, and click OK.
  7. In the solution explorer it'll display the new project (probably at the bottom).
  8. Right click the new project, and open Add->Existing Item
  9. Browse to src/plugins/ and select the sample2.c file, and hit OK.
  10. It will place the sample2.c file under the Source Files folder, drag it to the project you created and drop it (in a manner it be placed out of the source files folder)
  11. With the sample2.c out of the folders, delete the 3 of them (select the 3, hit delete, hit ok)
  12. Right click the project you created, open Properties
  13. Under Configuration Properties click General, change Output Directory to ..\plugins, Intermediate Directory to $(ProjectName)\$(ConfigurationName) and Configuration Type to Dynamic Library (.dll)
  14. Under Configuration Properties click C/C++ and open General, change Additional Include Directories to ..\src\common;..\3rdparty\msinttypes\include
  15. Under Configuration Properties click Linker and open General, change Output File to $(OutDir)\sample2.dll (change sample2.dll with your actual name, if you used a different one)
  16. Done, just add your code to the sample2.c file, and then right-click the project you created, and select Build

Notes

  • This guide is probably the worst I've ever written, if you can do better please hit the 'Edit' button, will be most welcome. - Ind
  • I used MSVC 2008 when testing this guide.