#include <windows.h>
#include "gamex86/CGame.h"
#pragma comment(lib, "gamex86.lib")
using namespace Narcotik;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) {
char szBuff[MAX_PATH+64];
GetModuleFileName(NULL,szBuff,MAX_PATH);
char* psz = strrchr(szBuff,'\\');
if(psz) psz[1] = '\0';
strcat(szBuff,"/base/gamex86.dll");
HMODULE hm = LoadLibrary(szBuff);
CGame game;
game.run();
FreeLibrary(hm);
return 0;
}
DLL in diferent directory
Yes, I have searched, and I found stuff about LoadLibrary() and FreeLibrary()....
Here is my code:
But I still get "cannot find DLL gamex86.dll" message....
Waht have I done wrong?
"\" is an escape character, which means whatever cmoes after it is treated as ascii and not some inbuilt command, so \\ will result in compiler putting in \ ...
I'm sure he knows that, I do as well... I just wanted to remove the initial slash.
Also, try putting MessageBox(NULL, szBuff, NULL, 0); before loading the library, it will show you the exact path it's trying to load it from. Maybe you'll see what's wrong this way.
Also, try putting MessageBox(NULL, szBuff, NULL, 0); before loading the library, it will show you the exact path it's trying to load it from. Maybe you'll see what's wrong this way.
I did strcat(szBuff,"base\\gamex86.dll"); and the directory shows up the way it is supposed to be on the MessageBox()
But it still doesnt work?
But it still doesnt work?
You appear to be linking to that dll statically:
#pragma comment(lib, "gamex86.lib")
In which case you cannot change the path. It must be in the working directory or system directories, or path directories.
edit - Remove that line and just load the dll dynamically.
#pragma comment(lib, "gamex86.lib")
In which case you cannot change the path. It must be in the working directory or system directories, or path directories.
edit - Remove that line and just load the dll dynamically.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement