LoadLibrary() from another DLL
Posted on 2003-11-17
I'm writing an set of ID 'tags' in dll form for the beta testers of my Half-Life mod (so if they leak my beta i'll know who it was) but i'm running into a problem.
i'm running this code:
HMODULE idlib = LoadLibrary("mod\\dlls\\id");
if(idlib == NULL)
strcpy(szRejectReason, "Unable to load id.dll");
the library loads correctly at this point.
i tried to get a pointer to the one and only function in the dll with this code:
typedef char* (*MYPROC)(void);
func = (MYPROC)GetProcAddress(idlib, "ID_GetTesterName");
but func is always null after this call, so I'm unable to get the Tester's ID.
So, I'm reduced to only making the id.dll be present to run the game; I had planned on only allowing one player with each ID in a multiplayer game at once (during the beta phase, anyway) so Joe can't share the mod with his friends.
Now, I may have had the typedef wrong in my original code, but would that have made func null?
I will try it once more in a moment, but i'd appreciate any help.
(I'd link the dll i'm compiling with id.lib at compile-time but then id.dll would have to be in the same folder as hl.exe, and I want it at the least in the mod folder.)