From cf320266df6faaaaf2cf94b0aacb3c589b1ee314 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 14 Mar 2024 17:49:04 +0100 Subject: [PATCH] fix: Linux build issues --- lib/libimhex/source/api/plugin_manager.cpp | 4 +++- .../script_loader/source/loaders/dotnet/dotnet_loader.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/libimhex/source/api/plugin_manager.cpp b/lib/libimhex/source/api/plugin_manager.cpp index b3e5c6d3e..61afac5df 100644 --- a/lib/libimhex/source/api/plugin_manager.cpp +++ b/lib/libimhex/source/api/plugin_manager.cpp @@ -49,7 +49,9 @@ namespace hex { } #else if (handle != 0) { - dlclose(reinterpret_cast(handle)); + if (dlclose(reinterpret_cast(handle)) != 0) { + log::error("Error when unloading library '{}': {}!", path.filename().string(), dlerror()); + } } #endif } diff --git a/plugins/script_loader/source/loaders/dotnet/dotnet_loader.cpp b/plugins/script_loader/source/loaders/dotnet/dotnet_loader.cpp index 2a6edb9d7..f7623ac77 100644 --- a/plugins/script_loader/source/loaders/dotnet/dotnet_loader.cpp +++ b/plugins/script_loader/source/loaders/dotnet/dotnet_loader.cpp @@ -86,7 +86,7 @@ namespace hex::script::loader { bool loadHostfxr() { #if defined(OS_WINDOWS) auto netHostLibrary = loadLibrary(L"nethost.dll"); - #elif defined(OS_LINUX) + #elif defined(OS_LINUX) auto netHostLibrary = loadLibrary("libnethost.so"); #elif defined(OS_MACOS) void *netHostLibrary = nullptr; @@ -162,7 +162,11 @@ namespace hex::script::loader { throw std::runtime_error(hex::format("Failed to initialize command line {:X}", result)); } - hostfxr_set_runtime_property_value(ctx, STRING("PINVOKE_OVERRIDE"), utf8ToUtf16(hex::format("{}", (void*)pInvokeOverride)).c_str()); + #if defined (OS_WINDOWS) + hostfxr_set_runtime_property_value(ctx, STRING("PINVOKE_OVERRIDE"), utf8ToUtf16(hex::format("{}", (void*)pInvokeOverride)).c_str()); + #else + hostfxr_set_runtime_property_value(ctx, STRING("PINVOKE_OVERRIDE"), hex::format("{}", (void*)pInvokeOverride).c_str()); + #endif result = hostfxr_get_runtime_delegate( ctx,