From 96c28280b6b97198d7411e1f03222f6ce889b2a3 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 3 Jan 2023 18:07:33 +0200 Subject: [PATCH] Move accessors of static data members to .cpp files Importing data items directly is tricky on MSVC, so better to hide them behind functions. --- source/core/application.cpp | 15 +++++++++++++++ source/core/application.h | 6 +++--- source/debug/errorreporter.cpp | 5 +++++ source/debug/errorreporter.h | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/source/core/application.cpp b/source/core/application.cpp index 1b77a7c..c214a06 100644 --- a/source/core/application.cpp +++ b/source/core/application.cpp @@ -118,6 +118,21 @@ void Application::set_startup_info(const char *argv0, void *data) _data = data; } +void *Application::get_data() +{ + return _data; +} + +const char *Application::get_argv0() +{ + return _argv0; +} + +const std::string &Application::get_name() +{ + return _name; +} + int Application::main() { done = false; diff --git a/source/core/application.h b/source/core/application.h index 2a1cc05..d5a571a 100644 --- a/source/core/application.h +++ b/source/core/application.h @@ -54,9 +54,9 @@ public: Application::run(). */ static void set_startup_info(const char *, void *); - static void *get_data() { return _data; } - static const char *get_argv0() { return _argv0; } - static const std::string &get_name() { return _name; } + static void *get_data(); + static const char *get_argv0(); + static const std::string &get_name(); protected: /** Default main loop. Calls tick() repeatedly until exit() is called. A diff --git a/source/debug/errorreporter.cpp b/source/debug/errorreporter.cpp index edfa002..6591c03 100644 --- a/source/debug/errorreporter.cpp +++ b/source/debug/errorreporter.cpp @@ -16,5 +16,10 @@ ErrorReporter::~ErrorReporter() _current = _prev; } +const ErrorReporter *ErrorReporter::get_current() +{ + return _current; +} + } // namespace Debug } // namespace Msp diff --git a/source/debug/errorreporter.h b/source/debug/errorreporter.h index ce14c63..b702b7c 100644 --- a/source/debug/errorreporter.h +++ b/source/debug/errorreporter.h @@ -20,7 +20,7 @@ protected: public: virtual ~ErrorReporter(); - static const ErrorReporter *get_current() { return _current; } + static const ErrorReporter *get_current(); virtual bool report_uncaught_exception(const std::exception &) const = 0; }; -- 2.43.0