I'm able to successfully load the .dll (i.e. LoadLibraryA returns a non-zero value) but each of my calls to GetProcAddress returns 0. I've done a decent amount of reading a fiddling, but I haven't been able to figure out the issue. If it matters, I compile everything from a Visual Studio 2013 project. Everything compiles without errors or warnings, and it correctly produces a Game.dll file.
Here are the relevant code sections:
Game.h:
1 2 3 4 5 6 7 | #define UPDATE_GAME(name) void name() typedef UPDATE_GAME(update_game); UPDATE_GAME(updateGameStub){} #define RENDER_GAME(name) void name() typedef RENDER_GAME(render_game); RENDER_GAME(renderGameStub){} |
Game.cpp:
1 2 3 4 5 6 7 8 9 | #include <Game.h> extern "C" UPDATE_GAME(updateGame){ return; } extern "C" RENDER_GAME(renderGame){ return; } |
Platform.cpp:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <Game.h> #include <Windows.h> [...] HMODULE GameCodeDLL; update_game* update; render_game* render; GameCodeDLL = LoadLibraryA(GAME_DLL_LOC); if (GameCodeDLL){ update = (update_game*)GetProcAddress(GameCodeDLL, "updateGame"); render = (render_game*)GetProcAddress(GameCodeDLL, "renderGame"); } else{ update = updateGameStub; render = renderGameStub; } |
Does anyone know what the issue could be?