summaryrefslogtreecommitdiffhomepage
path: root/opentrack/plugin-support.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-06 12:44:13 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-06 12:48:13 +0200
commitf4b1e06604c74bb56a88c7e9284c77ffbd1acc78 (patch)
tree1c7f96776b7c8a5db9d649c91f441105205498ad /opentrack/plugin-support.hpp
parentfcb8ca75c0c274be2321f0ba91e9f129ae63e354 (diff)
make "make_dylib_instance" part of public API
For @gagagu. Issue: #151
Diffstat (limited to 'opentrack/plugin-support.hpp')
-rw-r--r--opentrack/plugin-support.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp
index 627bce6a..32f79e0e 100644
--- a/opentrack/plugin-support.hpp
+++ b/opentrack/plugin-support.hpp
@@ -247,3 +247,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;
+}