I need help access global functions across DLLs/main program. I have a class Base
Base.h
#ifdef MAIN_DLL
#define DECLSPEC __declspec(dllexport)
#else
#define DECLSPEC __declspec(dllimport)
#endif
class Base {
private:
DECLSPEC static Filesystem * filesystem;
DECLSPEC static Logger * logger;
DECLSPEC static System * system;
public:
static void setFilesystem(Filesystem * filesystem_);
static void setApplication(Application * application_);
static void setLogger(Logger * logger_);
static void setSystem(System * system_);
static Filesystem * fs() { return filesystem; }
static Logger * log() { return logger; }
static System * sys() { return system; }
};
main.cpp (main application) (MAIN_DLL is predefined here)
Filesystem * Base::filesystem = 0;
Logger * Base::logger = 0;
System * Base::system = 0;
When I access from the dll:
System * system = Base::sys();
if(system == 0) std::cout << "Error";
Thanks, Gasim
See Question&Answers more detail:os