39#ifdef QT_BUILD_INTERNAL
41 if (!qEnvironmentVariableIsEmpty(
"QT_SIMULATE_DBUS_LIBFAIL"))
45 Q_CONSTINIT
static bool triedToLoadLibrary =
false;
46 Q_CONSTINIT
static QBasicMutex mutex;
47 const auto locker = qt_scoped_lock(mutex);
49 QLibrary *&lib = qdbus_libdbus;
50 if (triedToLoadLibrary)
51 return lib && lib->isLoaded();
54 lib->setLoadHints(QLibrary::ExportExternalSymbolsHint);
55 triedToLoadLibrary =
true;
57 static constexpr int majorversions[] = { 3, 2, -1 };
58 const QString baseNames[] = {
66 for (
const int majorversion : majorversions) {
67 for (
const QString &baseName : baseNames) {
70 if (majorversion != -1)
71 suffix = QString::number(- majorversion);
72 lib->setFileName(baseName + suffix);
74 lib->setFileNameAndVersion(baseName, majorversion);
76 if (lib->load() && lib->resolve(
"dbus_connection_open_private"))