I've found a solution to the problem!
First I downloaded a
random plugin's source code (FakeFull on that page). MSVC converted the project for 2010, I changed the include directories to work with my setup and removed the custom build step. The project then built successfully and loaded properly with metamod-p. After that, I started ripping parts of code out of the project hoping to find some special code that breaks it. I was able to remove almost everything until the "GiveFnptrsToDll" function in "meta_api.cpp". The Module Definition File used by FakeFull needs this for some reason but I decided to delete it anyway and change the project settings around so that I could compile without errors. Finally, it wouldn't load with metamod-p.
Enough backstory, here's how to get the stub plugin working:
(replace each "YOUR_PROJ" with your project's name)
1) Create a file in your project directory called "YOUR_PROJ.def".
2) Put this inside of it:
Code:
LIBRARY YOUR_PROJ
EXPORTS
GiveFnptrsToDll @1
SECTIONS
.data READ WRITE
3) Go into your project's settings and change this:
Linker->Input->Module Definition File->".\YOUR_PROJ.def"
4) Copy this function into your "meta_api.cpp" file:
Code:
void WINAPI GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) {
memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
gpGlobals = pGlobals;
}
5) Test it! I've attached my project files in case if it doesn't work for you. There may be some other project settings that you need changed.
Edit: I just realized this code was in h_export.cpp. I guess the definition file was the cause of the problem.