Eliminate QT_NO_DYNAMIC_LIBRARY

The library feature already covers this. As library depends on the
dlopen compile check, we can assume dlopen to be available, also on
vxworks.

Change-Id: Idcdb07ab4688c6158651d9a5ad5e2ba126bd7d9e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Ulf Hermann 2017-02-15 11:35:53 +01:00
parent 0f730ef7b6
commit 1aaf45e106
2 changed files with 11 additions and 23 deletions

View File

@ -211,8 +211,7 @@
},
"dlopen": {
"label": "dlopen()",
"condition": "tests.dlopen || libs.libdl",
"output": [ { "type": "define", "negative": true, "name": "QT_NO_DYNAMIC_LIBRARY" } ]
"condition": "tests.dlopen || libs.libdl"
},
"libdl": {
"label": "dlopen() in libdl",
@ -456,6 +455,7 @@
"label": "QLibrary",
"purpose": "Provides a wrapper for dynamically loaded libraries.",
"section": "File I/O",
"condition": "config.win32 || config.hpux || (!config.nacl && features.dlopen)",
"output": [ "publicFeature", "feature" ]
},
"settings": {

View File

@ -50,13 +50,9 @@
# include <private/qcore_mac_p.h>
#endif
#if (defined(Q_OS_VXWORKS) && !defined(VXWORKS_RTP)) || defined (Q_OS_NACL)
#define QT_NO_DYNAMIC_LIBRARY
#endif
QT_BEGIN_NAMESPACE
#if !defined(QT_HPUX_LD) && !defined(QT_NO_DYNAMIC_LIBRARY)
#if !defined(QT_HPUX_LD)
QT_BEGIN_INCLUDE_NAMESPACE
#include <dlfcn.h>
QT_END_INCLUDE_NAMESPACE
@ -64,9 +60,7 @@ QT_END_INCLUDE_NAMESPACE
static QString qdlerror()
{
#if defined(QT_NO_DYNAMIC_LIBRARY)
const char *err = "This platform does not support dynamic libraries.";
#elif !defined(QT_HPUX_LD)
#if !defined(QT_HPUX_LD)
const char *err = dlerror();
#else
const char *err = strerror(errno);
@ -131,7 +125,6 @@ QStringList QLibraryPrivate::prefixes_sys()
bool QLibraryPrivate::load_sys()
{
QString attempt;
#if !defined(QT_NO_DYNAMIC_LIBRARY)
QFileSystemEntry fsEntry(fileName);
QString path = fsEntry.path();
@ -250,7 +243,6 @@ bool QLibraryPrivate::load_sys()
}
}
#endif
#endif // QT_NO_DYNAMIC_LIBRARY
if (!pHnd) {
errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName).arg(qdlerror());
}
@ -263,29 +255,27 @@ bool QLibraryPrivate::load_sys()
bool QLibraryPrivate::unload_sys()
{
#if !defined(QT_NO_DYNAMIC_LIBRARY)
# if defined(QT_HPUX_LD)
#if defined(QT_HPUX_LD)
if (shl_unload((shl_t)pHnd)) {
# else
#else
if (dlclose(pHnd)) {
# endif
# if defined (Q_OS_QNX) // Workaround until fixed in QNX; fixes crash in
#endif
#if defined (Q_OS_QNX) // Workaround until fixed in QNX; fixes crash in
char *error = dlerror(); // QtDeclarative auto test "qqmlenginecleanup" for instance
if (!qstrcmp(error, "Shared objects still referenced")) // On QNX that's only "informative"
return true;
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName)
.arg(QLatin1String(error));
# else
#else
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName).arg(qdlerror());
# endif
#endif
return false;
}
#endif
errorString.clear();
return true;
}
#if defined(Q_OS_LINUX) && !defined(QT_NO_DYNAMIC_LIBRARY)
#if defined(Q_OS_LINUX)
Q_CORE_EXPORT QFunctionPointer qt_linux_find_symbol_sys(const char *symbol)
{
return QFunctionPointer(dlsym(RTLD_DEFAULT, symbol));
@ -305,8 +295,6 @@ QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
QFunctionPointer address = 0;
if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0)
address = 0;
#elif defined (QT_NO_DYNAMIC_LIBRARY)
QFunctionPointer address = 0;
#else
QFunctionPointer address = QFunctionPointer(dlsym(pHnd, symbol));
#endif