diff options
Diffstat (limited to 'opentrack/plugin-support.hpp')
-rw-r--r-- | opentrack/plugin-support.hpp | 13 |
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; +} |