summaryrefslogtreecommitdiffhomepage
path: root/opentrack/plugin-support.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-08 05:55:32 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-08 05:55:59 +0200
commit527eef2a2f0e68b286e1b782ba148ecdfafbb89c (patch)
tree2be0f0b96df712f7b12534291db3c36564be62ca /opentrack/plugin-support.hpp
parent3a54a111567370ecf903704d702d12736b693a8e (diff)
parentab47eac174db02710a7fa6c194e00c31cef755a4 (diff)
Merge branch 'unstable' into trackhat-ui
Diffstat (limited to 'opentrack/plugin-support.hpp')
-rw-r--r--opentrack/plugin-support.hpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp
index 7f2734af..78443cae 100644
--- a/opentrack/plugin-support.hpp
+++ b/opentrack/plugin-support.hpp
@@ -1,5 +1,3 @@
-#pragma once
-
/* Copyright (c) 2015 Stanislaw Halik
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -7,6 +5,8 @@
* copyright notice and this permission notice appear in all copies.
*/
+#pragma once
+
#include "plugin-api.hpp"
#include "options.hpp"
@@ -242,3 +242,12 @@ private:
return ret;
}
};
+
+template<typename t>
+mem<t> make_dylib_instance(mem<dylib> lib)
+{
+ mem<t> ret;
+ if (lib != nullptr && lib->Constructor)
+ ret = mem<t>(reinterpret_cast<t*>(reinterpret_cast<OPENTRACK_CTOR_FUNPTR>(lib->Constructor)()));
+ return ret;
+}