Original Post
Today I started work on moving the graphics library code in my game into a seperate DLL so switching APIs would be easier and I could rework the graphics code without rebuilding the entire game. Unfortunately, I've never really worked with DLLs before and they're giving me a spot of trouble.
I started a new .DLL project in Visual Studio .Net and looked it over. So far I only have two functions in there:
So far just stubs, but later will serve as the first and last functions to be called for the graphics subsystem.
Anyway, moving on to the code within the game:
Neither function is correctly retrieved, but the library does load properly. Any suggestions to fix it, or anything obvious stick out?
If more information is needed, I can provide.
[edited by - Omaha on February 19, 2003 12:36:09 AM]
[edited by - Omaha on February 19, 2003 12:37:39 AM]
#define OPENGLDLL_API __declspec(dllexport)
...
OPENGLDLL_API int Initialize()
{
return 1;
}
OPENGLDLL_API int Shutdown()
{
return 0;
}
typedef int (*VIDEOINITIALIZEPROC)(void);
typedef int (*VIDEOSHUTDOWNPROC)(void);
VIDEOINITIALIZEPROC InitializeVideo;
VIDEOSHUTDOWNPROC ShutdownVideo;
...
switch(Config.VideoConfig.VideoAPI)
{
case VIDEOAPI_OPENGL: VideoDLL=LoadLibrary("video_opengl.dll");
break;
...
default: break;
}
...
InitializeVideo=(VIDEOINITIALIZEPROC)GetProcAddress(VideoDLL, "Initialize");
ShutdownVideo=(VIDEOSHUTDOWNPROC)GetProcAddress(VideoDLL, "Shutdown");