1
0
mirror of synced 2025-02-20 04:01:01 +01:00

impr: Make sure to only ever load plugins once

This commit is contained in:
WerWolv 2025-02-16 15:14:23 +01:00
parent 6ec8f9efe5
commit 67340e1526

View File

@ -30,7 +30,11 @@ namespace hex {
return handle;
#else
auto handle = uintptr_t(dlopen(wolv::util::toUTF8String(path).c_str(), RTLD_LAZY));
const auto pathString = wolv::util::toUTF8String(path);
auto handle = uintptr_t(dlopen(pathString.c_str(), RTLD_NOLOAD));
if (handle == 0)
handle = uintptr_t(dlopen(pathString.c_str(), RTLD_NOW | RTLD_GLOBAL));
if (handle == 0) {
log::error("Loading library '{}' failed: {}!", wolv::util::toUTF8String(path.filename()), dlerror());