From dfbe00cb1d9ce4cb52448cf4c1d577fe7b1eaad7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 16 Jul 2015 11:29:45 +0200 Subject: api: introduce macros for symbol exposure --- opentrack/plugin-qt-api.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/opentrack/plugin-qt-api.hpp b/opentrack/plugin-qt-api.hpp index 89b71f81..2ccdad19 100644 --- a/opentrack/plugin-qt-api.hpp +++ b/opentrack/plugin-qt-api.hpp @@ -4,6 +4,20 @@ #include #include +#define OPENTRACK_DECLARE_PLUGIN_INTERNAL(ctor_class, ctor_ret_class, metadata_class, dialog_class, dialog_ret_class) \ + extern "C" OPENTRACK_EXPORT ctor_ret_class* GetConstructor() \ + { \ + return new ctor_class; \ + } \ + extern "C" OPENTRACK_EXPORT Metadata* GetMetadata() \ + { \ + return new metadata_class; \ + } \ + extern "C" OPENTRACK_EXPORT dialog_ret_class* GetDialog() \ + { \ + return new dialog_class; \ + } + // implement this in all plugins struct Metadata { @@ -91,3 +105,7 @@ struct ITrackerDialog : public QWidget // received tracker pointer is about to get deleted virtual void unregister_tracker() = 0; }; + +// call once with your chosen class names in the plugin +#define OPENTRACK_DECLARE_TRACKER(tracker_class, dialog_class, metadata_class) \ + OPENTRACK_DECLARE_PLUGIN_INTERNAL(tracker_class, ITracker, metadata_class, dialog_class, ITrackerDialog) -- cgit v1.2.3