1
0
mirror of synced 2024-09-24 03:28:24 +02:00

fix: Manually initialize library plugins

This commit is contained in:
WerWolv 2024-01-09 11:31:56 +01:00
parent 037d77f28e
commit 0b5656dcc4
4 changed files with 5 additions and 10 deletions

@ -1 +1 @@
Subproject commit 78cdc3e7fd67ec7c95a186ee97215ff29a0316ce
Subproject commit 7fd9967ee74250876a272819c3a70e39200bc68d

View File

@ -29,11 +29,6 @@
#define IMHEX_LIBRARY_SETUP_IMPL(name) \
namespace { static struct EXIT_HANDLER { ~EXIT_HANDLER() { hex::log::info("Unloaded library '{}'", name); } } HANDLER; } \
IMHEX_PLUGIN_VISIBILITY_PREFIX void initializeLibrary(); \
static auto WOLV_TOKEN_CONCAT(libraryInitializer_, IMHEX_PLUGIN_NAME) = [] { \
initializeLibrary(); \
hex::log::info("Library plugin '{}' initialized successfully", WOLV_STRINGIFY(IMHEX_PLUGIN_NAME)); \
return 0; \
}(); \
IMHEX_PLUGIN_VISIBILITY_PREFIX void setImGuiContext(ImGuiContext *ctx) { \
ImGui::SetCurrentContext(ctx); \
GImGui = ctx; \

View File

@ -92,10 +92,10 @@ namespace hex {
const auto pluginName = wolv::util::toUTF8String(m_path.filename());
if (this->isLibraryPlugin()) {
m_initialized = true;
return true;
m_functions.initializeLibraryFunction();
}
const auto requestedVersion = getCompatibleVersion();
if (requestedVersion != ImHexApi::System::getImHexVersion()) {
if (requestedVersion.empty()) {

View File

@ -390,10 +390,10 @@ namespace hex {
return "";
#elif defined(OS_MACOS) || defined(OS_LINUX)
std::array<char, 256> name;
std::array<char, 256> name = { };
pthread_getname_np(pthread_self(), name.data(), name.size());
return name;
return name.data();
#elif defined(OS_WEB)
return "";
#else