QLibrary works fine to obtain one set of function pointers from one instance of an .so library. However, it does not work when trying to obtain two different instances of function pointers from the same .so file. Both sets of pointers point to the same locations in memory, making them redundant and not useful. According to the docs for Qt 5.12 QLibrary:
Multiple instances of QLibrary can be used to access the same physical library.
They don't say how this is supposed to work, so should you just be able to load two instances of the same .so file with two QLibraries? Or am I misunderstanding and you really need two copies of the same library file?
Code below in case my explanation is not clear:
QLibrary loader1("lib.so");
loader1.load();
foo1 = reinterpret_cast<foo>(loader1.resolve("foo"));
foo1();
QLibrary loader2("lib.so");
loader2.load();
foo2 = reinterpret_cast<foo>(loader2.resolve("foo"));
foo2();
// foo1 and foo2 both call the same instance of the foo function instead of separate instances