summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@nokia.com>2011-02-25 11:03:19 +0100
committerMorten Sorvig <msorvig@trolltech.com>2011-03-16 10:42:26 +0100
commit468142db15fe99c70505f507f6c2941706172853 (patch)
treeabe597da8a63d0e5cf87b2bdbdd587eb3443fd07 /src/corelib/plugin
parent5ba2675a33922cdd4ccef7de968e77b05bc1d556 (diff)
Add QT_NO_DYNAMIC_LIBRARY.
Set it for nacl, replace the Q_OS defines vxworks already has in place. Motivation: Support static plugins on platforms that does not support dynamic plugins. Static plugin support is implemented in QPluginLoader, which has a QLibraryPrivate d pointer. The easiest way to untangle this seems to be to compile in QLibrary and then disable the ports of it that uses dlopen. Reviewed-By: Harald Fernengel
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r--src/corelib/plugin/qlibrary_unix.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index 466350e7de..e32729a780 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -56,9 +56,13 @@
#include <string.h>
#endif
+#if defined(Q_OS_VXWORKS) || defined (Q_OS_NACL)
+#define QT_NO_DYNAMIC_LIBRARY
+#endif
+
QT_BEGIN_NAMESPACE
-#if !defined(QT_HPUX_LD) && !defined(Q_OS_VXWORKS)
+#if !defined(QT_HPUX_LD) && !defined(QT_NO_DYNAMIC_LIBRARY)
QT_BEGIN_INCLUDE_NAMESPACE
#include <dlfcn.h>
QT_END_INCLUDE_NAMESPACE
@@ -66,8 +70,8 @@ QT_END_INCLUDE_NAMESPACE
static QString qdlerror()
{
-#if defined(Q_OS_VXWORKS)
- const char *err = "VxWorks does not support dynamic libraries.";
+#if defined(QT_NO_DYNAMIC_LIBRARY)
+ const char *err = "This platform does not support dynamic libraries.";
#elif !defined(QT_HPUX_LD)
const char *err = dlerror();
#else
@@ -79,7 +83,7 @@ static QString qdlerror()
bool QLibraryPrivate::load_sys()
{
QString attempt;
-#if !defined(Q_OS_VXWORKS)
+#if !defined(QT_NO_DYNAMIC_LIBRARY)
QFileInfo fi(fileName);
#if defined(Q_OS_SYMBIAN)
@@ -235,7 +239,7 @@ bool QLibraryPrivate::load_sys()
}
}
#endif
-#endif // Q_OS_VXWORKS
+#endif // QT_NO_DYNAMIC_LIBRARY
if (!pHnd) {
errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName).arg(qdlerror());
}
@@ -248,7 +252,7 @@ bool QLibraryPrivate::load_sys()
bool QLibraryPrivate::unload_sys()
{
-#if !defined(Q_OS_VXWORKS)
+#if !defined(QT_NO_DYNAMIC_LIBRARY)
# if defined(QT_HPUX_LD)
if (shl_unload((shl_t)pHnd)) {
# else
@@ -282,7 +286,7 @@ void* QLibraryPrivate::resolve_sys(const char* symbol)
void* address = 0;
if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0)
address = 0;
-#elif defined(Q_OS_VXWORKS)
+#elif defined (QT_NO_DYNAMIC_LIBRARY)
void *address = 0;
#else
void* address = dlsym(pHnd, symbol);