From 1aaf45e10680242511c047d84ec4f1c9a86cda7f Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 15 Feb 2017 11:35:53 +0100 Subject: 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 --- src/corelib/configure.json | 4 ++-- src/corelib/plugin/qlibrary_unix.cpp | 30 +++++++++--------------------- 2 files changed, 11 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 66bf0dac92..76dfed3128 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -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": { diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 9db0b7ff39..8b16021303 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -50,13 +50,9 @@ # include #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 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 -- cgit v1.2.3