run time dlls
Hi,
I was prototyping my engine, but i get an error appears and I don''t know why.
I got an engine class in a dll (engine.dll) that is loaded at load time in the main executable (launch.exe) via a .lib file.
Now the engine class contains a pointer to an abstract base
class called ''rendrv'' and several functions :
class ENGINE_API engine
{
HINSTANCE hdll;
rendrv* p;
void print(HDC h, int x, int y)
{
p->print(h, x, y);
}
void init();
void exit();
};
the idea is that rendrv is an abstract base class to two other interfaces, one for drawing in OpenGL and one in DirectX.
class GL_API glrendrv : public rendrv
{
public:
virtual void print(HDC h, int x, int y)
{
char str[] = "glrendrv output";
TextOut(h, x, y, str, strlen(str));
}
}
now the init function loads explicitly the glrendrv dll and casts
it''s rendrv pointer to a glrendrv pointer.
now in my launch code, i have the following
engine e;
e.init();
e.print(HDC, 0, 0);
e.exit();
now when e.print is called i get an exception : access violation.
can anibody tell me what is wrong, or is it impossible for a class member function in a load time dll, to load dynamicly a class at run time from a dll?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement