Details
-
Suggestion
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
None
Description
It would be nice if QLibrary supported resolving symbols from the application and currently loaded libraries, and not only from a particular library to be loaded. This could then be used to perform run-time checks for symbols, and be used to only load a library if the symbol is not already present.
For example, the following static QLibrary function would be useful, which returns a platform dependent handle if the symbol could be found in the currently loaded libraries, or 0 if the symbol could not be resolved:
Qt::HANDLE resolve(const char *symbol)
A use-case for this is on X11 and in the QGLContext::getProcAddress() function, where the GL library is loaded and the glXGetProcAddressARB() function is attempted resolved. However, if the QtOpenGL library already links against some OpenGL library which contains the above symbol, the GL library is still loaded, and a crash may occur at some point due to symbol clashes. If QLibrary supported checking currently loaded symbols, this could easily be avoided, as the GL library could then be loaded only if the glXGetProcAddressARB symbol is not already present.
Attachments
Issue Links
- depends on
-
QTBUG-1849 Only load library and resolve symbol if the symbol is not already present
-
- Closed
-