From 3798654f9279beab1a217c89688e0603ccb695b6 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Wed, 13 Mar 2024 08:38:40 +0100 Subject: [PATCH] fix: Unix build issues with dladdr --- lib/libimhex/source/helpers/utils.cpp | 4 ++-- plugins/script_loader/source/loaders/dotnet/dotnet_loader.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/libimhex/source/helpers/utils.cpp b/lib/libimhex/source/helpers/utils.cpp index 167aad31e..b56db3f79 100644 --- a/lib/libimhex/source/helpers/utils.cpp +++ b/lib/libimhex/source/helpers/utils.cpp @@ -795,8 +795,8 @@ namespace hex { return nullptr; #elif !defined(OS_WEB) - Dl_info info; - if (dladdr(symbol, nullptr) == 0) + Dl_info info = {}; + if (dladdr(symbol, &info) == 0) return nullptr; return dlopen(info.dli_fname, RTLD_LAZY); diff --git a/plugins/script_loader/source/loaders/dotnet/dotnet_loader.cpp b/plugins/script_loader/source/loaders/dotnet/dotnet_loader.cpp index 117da86b7..0fcd35d11 100644 --- a/plugins/script_loader/source/loaders/dotnet/dotnet_loader.cpp +++ b/plugins/script_loader/source/loaders/dotnet/dotnet_loader.cpp @@ -77,8 +77,7 @@ namespace hex::script::loader { if (library == "cimgui") { return getExport(ImHexApi::System::getLibImHexModuleHandle(), symbolName); } else if (library == "ImHex") { - auto address = getExport(hex::getContainingModule((void*)&pInvokeOverride), symbolName); - return address; + return getExport(hex::getContainingModule((void*)&pInvokeOverride), symbolName); } return nullptr;