diff --git a/include/reframework/API.hpp b/include/reframework/API.hpp index 65737e60c..be412c15b 100644 --- a/include/reframework/API.hpp +++ b/include/reframework/API.hpp @@ -1,6 +1,7 @@ #pragma once #ifdef __cplusplus_cli +#pragma managed #include #include //#include @@ -127,16 +128,16 @@ class API { public: // ALWAYS call initialize first in reframework_plugin_initialize #ifndef __cplusplus_cli - static API& initialize(const REFrameworkPluginInitializeParam* param); + static inline std::unique_ptr& initialize(const REFrameworkPluginInitializeParam* param); #else - static API^ initialize(uintptr_t param); + static inline API^ initialize(uintptr_t param); #endif // only call this AFTER calling initialize #ifndef __cplusplus_cli - static auto& get() { + static inline auto& get() { #else - static auto get() { + static inline auto get() { #endif if (s_instance == nullptr) { throw std::runtime_error("API not initialized"); @@ -342,6 +343,12 @@ class API { return (void*)this; } }; + + #define POINTER_CONTAINER_CONSTRUCTOR(WrapperType, Tx) WrapperType(Tx ptr) : PointerContainer(ptr) {} + #define PUBLIC_POINTER_CONTAINER(X, Tx) struct X : public PointerContainer { \ + public:\ + X(Tx ptr) : PointerContainer(ptr) {} + #endif //#define PUBLIC_POINTER_CONTAINER(Tx) : public PointerContainer @@ -1154,9 +1161,9 @@ else // ALWAYS call initialize first in reframework_plugin_initialize #ifndef __cplusplus_cli -reframework::API& reframework::API::initialize(const REFrameworkPluginInitializeParam* param) { +inline std::unique_ptr& reframework::API::initialize(const REFrameworkPluginInitializeParam* param) { #else -reframework::API^ reframework::API::initialize(uintptr_t param) { +inline reframework::API^ reframework::API::initialize(uintptr_t param) { #endif #ifndef __cplusplus_cli if (param == nullptr) {