Hello all :)
I'm working on a DLL with various of functions I later need in other applications. I have many classes, and most of them I need a global instance of. I've tried various things such as a singletonptr, singleton, global instantiation.
What I need to achieve is the ability to use the same instance of a class from the client application, but also in the DLL.
An example of what I want to be able to:
DLL_Log:
void createLog(){ create_txt_file(); and_save_pointer(); }
void writeToLog(message){ open_txt_file(with_saved_pointer()); }
DLL_Math:
void AplusB(int a, int b){ log_class->writeToLog(a+b); }
EXE_Main:
log_class->createLog();
log_class->writeLog("application started!");
math_class->AplusB(5, 20);
Now the log file should be something like "Application started" "25".
In what I have made, I would get two different log classes, one in the DLL and one in the EXE.
What ways are there to do this?
Sorry for the poor sample code, but I didn't have anything small I could copy over.
Thanks
- Excizted :)