Accessing global variables of an application from a DLL
Hi all !!
I have a problem with DLLs !! My 3DEngine has a few Global Variables. One of them is an instance to a class CRenderer !! CRenderer has all the member variables for DirectX and Direct3D (so the backbuffer, z-buffer, and so on) and functions to render my primitives such as walls, Meshes and stuff. In my file 3dengine.cpp this looks like:
...
CRenderer Renderer;
....
In the header 3dengine.h:
....
extern CRenderer Renderer;
....
Ok, so I can access Renderer from everywhere in my program if I include 3dengine.h !! This works very fine, however I have a problem.
I know want to create a DLL which is Loaded with LoadLibrary. I call Functions of this DLL using GetProcAdress. I need to go this way (I cannot use the header and use a lib) !!
Now, does anyone know how I can access this global variable Renderer from my DLL ???
If I put a extern CRenderer Renderer in my DLL, the compiler works fine, but the linker gives errors !! I don''t want to pass Pointers of these instances to my dll.
Thanks very much for your help,
Phillip
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement