14 void *dbus_handle{nullptr};
15 #define DECL_FUNC(x) decltype(p##x) p##x{};
16 DBUS_FUNCTIONS(DECL_FUNC)
21 static constexpr char libname[] = "libdbus-1.so.3";
23 auto load_func = [](auto &f, const char *name) -> void
24 { f = reinterpret_cast<std::remove_reference_t<decltype(f)>>(GetSymbol(dbus_handle, name)); };
25 #define LOAD_FUNC(x) do { \
26 load_func(p##x, #x); \
29 WARN("Failed to load function %s\n", #x); \
30 CloseLib(dbus_handle); \
31 dbus_handle = nullptr; \
36 dbus_handle = LoadLib(libname);
39 WARN("Failed to load %s\n", libname);
43 DBUS_FUNCTIONS(LOAD_FUNC)