Archived

This topic is now archived and is closed to further replies.

JinJo

hard to explain, singleton across dll problem

Recommended Posts

I have this problem with my resource manager, all the code works perfectly as it worked fine in another project, however now i am doing a new api independant game engine and so the texture manager part works different for DirectX and OpenGL. My resource manager class is a simple base class that defines variables and functions that all derived classes used, one of the derived classes is a texture manager, this also inherits from my singleton class. Since the code in here will be api specific I have made it a pure virtual class. Now in each api specific rendering dll project I then derive the appropriate texture manager from the virtual class, e.g OGLTextureManager. I get a pointer to this class through dll export functions. The problem lies in the OGLTextureManager''s load function. In here I then call the base class, ResourceManager, load function e.g E_ResourceManager::Load(); this then gives me an assertion error complaining about the singleton. Can anyone explain what I''m doing wrong? Actually I think making the OGLTextureManager class inherit the singlton instead of the virtual class, although this may be stupid as the dx version also needs to be a singleton.

Share this post


Link to post
Share on other sites
Possible problem 1: you aren''t linking all your DLLs and the application against the shared DLL version of the CRT.

Possible problem 2: you aren''t properly exporting your base class.

Share this post


Link to post
Share on other sites
Well I can''t test any code just now but here''s some more info:

1) I believe this isn''t the problem as I also get my main renderer object ptr from the same dll and that works fine.

2) I don''t know if i am or not, every other part of my engine is in its own console program project as the engine runs the game, instead of a game linking to the engine. My renderer base class is defined here along with the resource manager and texture manager and that as i said works fine and i dont think i have any difference between them, each exports some global functions that get and destroy ptrs to the derived classes.

Should I put dllexport (can''t remember the exact command) next to my base class definitions?

Share this post


Link to post
Share on other sites