Building HPM Plugin for MSVC
From Hercules Wiki
This is a guide on how to prepare your MSVC environment for a new HPM plugin.
Guide
- Go to src/plugins/ folder, create a new .c file, e.g. sample2.c (this name will be used throughout this guide)
- Open your MSVC project (e.g. 'Hercules-9.sln)
- Go to the Solution Explorer
- Right click the Hercules project (first item in Solution Explorer), and click Add->New Project
- Select General, and pick Empty Project.
- Enter the name of your plugin in the Name field, and click OK.
- In the solution explorer it'll display the new project (probably at the bottom).
- Right click the new project, and open Add->Existing Item
- Browse to src/plugins/ and select the sample2.c file, and hit OK.
- 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)
- With the sample2.c out of the folders, delete the 3 of them (select the 3, hit delete, hit ok)
- Right click the project you created, open Properties
- Under Configuration Properties click General, change Output Directory to ..\plugins, Intermediate Directory to $(ProjectName)\$(ConfigurationName) and Configuration Type to Dynamic Library (.dll)
- Under Configuration Properties click C/C++ and open General, change Additional Include Directories to ..\src\common;..\3rdparty\msinttypes\include
- 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)
- 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.