diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 11cded7be..47a771442 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -347,14 +347,23 @@ void plat_language_code_r(uint32_t lcid, char* outbuf, int len) { void* dynld_module(const char *name, dllimp_t *table) { - auto lib = std::unique_ptr(new QLibrary(name)); + QString libraryName = name; + QFileInfo fi(libraryName); + QStringList removeSuffixes = {"dll", "dylib", "so"}; + if (removeSuffixes.contains(fi.suffix())) { + libraryName = fi.completeBaseName(); + } + + auto lib = std::unique_ptr(new QLibrary(libraryName)); if (lib->load()) { for (auto imp = table; imp->name != nullptr; imp++) { - if ((imp->func = reinterpret_cast(lib->resolve(imp->name))) != nullptr) - { + auto ptr = lib->resolve(imp->name); + if (ptr == nullptr) { return nullptr; } + auto imp_ptr = reinterpret_cast(imp->func); + *imp_ptr = reinterpret_cast(ptr); } } else { return nullptr;