plugin and application have diffrent instance of a singleton class

hello, I am writing a plugin and plugin calls a singleton of the application in order to register itself, however, in the plugin, applications signleton class creates a new copy of it self, so the plugin is registered with this new instance of the application. How can I fix this ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "amzMain.h"

// Plugin it self
Dx11RenderPlugin* plugin;

extern "C" _AmzExport void dllStartPlugin(void)
{
plugin = new Dx11RenderPlugin();
// add it to the main
// this line creates a new instance of the main
Main::getSingleton().initializePlugin(plugin);
}

extern "C" _AmzExport void dllStopPlugin(void)
{
// this line creates a new instance of the main
Main::getSingleton().uninitializePlugin(plugin);
delete plugin;
}
Last edited on
Topic archived. No new replies allowed.