Ok I've followed the Codeguru link and I'm pretty certain I understand it. However I'm now getting compile errors. Here's the client program - are there any obvious mistakes?
Code:
#include <windows.h>
#include ".\main.h"
typedef PVWindow* (*DLL_CreatePVWindowA_t) ();
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
HMODULE hPVWMod = LoadLibrary ("PV.dll");
DLL_CreatePVWindowA_t DLL_CreatePVWindowA = 0;
PVWindow *PVWnd = 0;
if (hPVWMod == NULL)
{
MessageBox (0, "Unable to load library [PV.dll]", "ERROR", MB_OK | MB_ICONERROR);
return 1;
}
DLL_CreatePVWindowA = (DLL_CreatePVWindowA_t) GetProcAddress (hPVWMod, TEXT("CreatePVWindowA"));
if (DLL_CreatePVWindowA == NULL)
{
MessageBox (0, "Unable to load CreatePVWindowA", "ERROR", MB_OK | MB_ICONERROR);
return 1;
}
delete PVWnd;
return 0;
}
Here's the errors I get:
Code:
------ Build started: Project: TestGame, Configuration: Debug Win32 ------
Compiling...
Main.cpp
x:\PV1\TestGame\Main.cpp(10) : error C2143: syntax error : missing ';' before '*'
x:\PV1\TestGame\Main.cpp(10) : error C2501: 'DLL_CreatePVWindowA_t' : missing storage-class or type specifiers
x:\PV1\TestGame\Main.cpp(15) : error C2146: syntax error : missing ';' before identifier 'DLL_CreatePVWindowA'
x:\PV1\TestGame\Main.cpp(15) : error C2065: 'DLL_CreatePVWindowA' : undeclared identifier
x:\PV1\TestGame\Main.cpp(24) : error C2146: syntax error : missing ';' before identifier 'GetProcAddress'
x:\PV1\TestGame\Main.cpp(24) : error C3861: 'DLL_CreatePVWindowA': identifier not found, even with argument-dependent lookup
x:\PV1\TestGame\Main.cpp(26) : error C3861: 'DLL_CreatePVWindowA': identifier not found, even with argument-dependent lookup
Build log was saved at "file://x:\Pv1\TestGame\Debug\BuildLog.htm"
TestGame - 7 error(s), 0 warning(s)
I suppose I'd better post the class declaration too:
Code:
class PVWindow
{
public:
PVWindow (void);
~PVWindow (void);
virtual bool Initialise ();
virtual bool NewWindow (WNDPROC wndProc, const char *cCaption, int iWidth,
int iHeight, int iBits, bool bFullScreen);
virtual void Shutdown ();
private:
// Functions
void ResizeScene (int iWidth, int iHeight);
// Variables
HGLRC m_hRC; // Rendering context
HDC m_hDC; // GDI Device Context
HWND m_hWnd; // Window handle
HINSTANCE m_hInstance;
char *m_cClassName;
bool m_bInitialised;
bool m_bFullScreen;
};
Sorry to dump all this code on whomever is reading this, but I really need some help understanding this.