41 #include <QtCore/qglobal.h>
42 #if QT_CONFIG(library)
43 #include <QtCore/qlibrary.h>
44 #include <QtCore/private/qlocking_p.h>
46 #include <QtCore/qmutex.h>
56 #if !defined QT_LINKED_LIBDBUS
58 #if QT_CONFIG(library)
59 static QLibrary *qdbus_libdbus =
nullptr;
61 void qdbus_unloadLibDBus()
64 if (qEnvironmentVariableIsSet(
"QDBUS_FORCE_SHUTDOWN"))
65 qdbus_libdbus->
resolve(
"dbus_shutdown")();
69 qdbus_libdbus =
nullptr;
75 #if QT_CONFIG(library)
76 #ifdef QT_BUILD_INTERNAL
78 if (!qEnvironmentVariableIsEmpty(
"QT_SIMULATE_DBUS_LIBFAIL"))
82 static bool triedToLoadLibrary =
false;
87 if (triedToLoadLibrary)
92 triedToLoadLibrary =
true;
94 static int majorversions[] = { 3, 2, -1 };
103 for (
const int majorversion : majorversions) {
104 for (
const QString &baseName : baseNames) {
107 if (majorversion != -1)
113 if (lib->
load() && lib->
resolve(
"dbus_connection_open_private"))
130 #if QT_CONFIG(library)
141 #if QT_CONFIG(library)
143 qFatal(
"Cannot find libdbus-1 in your system to resolve symbol '%s'.",
name);
145 QFunctionPointer ptr = qdbus_libdbus->
resolve(
name);
147 qFatal(
"Cannot resolve '%s' in your libdbus-1.",
name);
157 static void qdbus_unloadLibDBus()
159 if (qEnvironmentVariableIsSet(
"QDBUS_FORCE_SHUTDOWN"))
165 #if defined(QT_LINKED_LIBDBUS) || QT_CONFIG(library)
166 Q_DESTRUCTOR_FUNCTION(qdbus_unloadLibDBus)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
The QLibrary class loads shared libraries at runtime.
@ ExportExternalSymbolsHint
void setFileNameAndVersion(const QString &fileName, int verNum)
void setFileName(const QString &fileName)
void setLoadHints(LoadHints hints)
QFunctionPointer resolve(const char *symbol)
The QMutex class provides access serialization between threads.
The QString class provides a Unicode character string.
static QString number(int, int base=10)
Lock qt_scoped_lock(Mutex &mutex)
QT_BEGIN_NAMESPACE void(*)() qdbus_resolve_me(const char *name)
void(*)() qdbus_resolve_conditionally(const char *name)