How could i get a singleton instance of IrrlichtDevice, Since i must use it in a dll which as a plugin. And i apparently know when i create the device, and when i load then use the plugin. i can make sure that i use the dll(plugin) after the creation of the IrrlichtDevice.
But now, i can't ge a singleton of the IrrlichtDevice to access it. How can i do it. Should I write a wrap for it, or irrlicht has already implemented it.
How could i get a singleton instance of IrrlichtDevice
The Singleton pattern doesn't apply well to DLLs, if you had a singleton in your host app or your dll, you'd still get two different instances of the singleton because they live in separate address spaces.
You *could* hack it and have a static global IrrDevice in your DLL and retreive the pointer to it using an exported function, but as Irrlicht isn't coded for multi-threading it might start becoming tricky for your to manage, especially if other applications are using your DLL (however unlikely).
You *could* hack it and have a static global IrrDevice in your DLL and retreive the pointer to it using an exported function, but as Irrlicht isn't coded for multi-threading it might start becoming tricky for your to manage, especially if other applications are using your DLL (however unlikely).