I have a main application EXE "main.EXE". I've created a global pointer in a header file globalf.h with extern like:
globalf.h
extern SomeClass* cPtr;
Now in Main.EXE code
#include globalf.h
INitialize()
{
cPtr = new SomeClass(); // works fine.
D.DLL:
#include "globalf.h"
void DllFunc()
{
cPtr->someFunction1(); // link error unreslved external symbol.
I'm not able to access the global pointer variable in DLL code, even though I had declared inMain.EXE code.
I know this declaration in main.EXE's Initialize() isn't visible to DLL. But how do I achieve this? Is there a way in C++ for handling such globals across DLL & EXEs.