GDBus support on Win32 + other platforms (Was Re: GtkApplication and argc/arv)



Hi,

Just for the record, there's no reason that GDBus cannot be made to
work very nicely on Win32 or any other platform we care about. GDBus
(and D-Bus itself) was designed with this goal in mind.

That is to say, it is possible to make a Win32 build of GLib where
GDBus works as expect in both peer-to-peer mode (this already works,
GDBus supports e.g. the nonce-tcp: transport) and in session bus mode
(including autospawning the bus if necessary and talking to other apps
etc.)

FWIW, the latter clearly includes shipping a copy of dbus-daemon.exe
along with the GLib libraries which you already need to ship as part
of your app. It also includes D-Bus spec work to find the address of
the bus - right now this is *undocumented* (that is,
http://dbus.freedesktop.org/doc/dbus-specification.html does not
mention how) but I had this working at some point, see

 http://cgit.freedesktop.org/~david/gdbus-standalone/commit/?id=44c8871c5c27337dc1905a0b4c9d35d46eb2144a
 http://people.freedesktop.org/~david/gdbus-win32.png

If someone wants to work on this, I'd recommend

1. Get the missing pieces into the spec (the DBusAutolaunchMutex and
DBusDaemonMutex stuff).

2. Make "dbus-launch --autolaunch=<machine_id> --binary-syntax
--close-stderr" a supported and official D-Bus interface - because
with this 3rd party D-Bus implementations (like GDBus) can simply use
that to launch the message bus (e.g. not have to care about where to
get the bus address, be it in the X server, the Windows registry, OS
X's launch or whatever). Note: on the free desktop we actually rely on
this to work

 http://git.gnome.org/browse/glib/tree/gio/gdbusaddress.c?id=2.28.0#n1012

3. Ship dbus-daemon.exe and dbus-launch.exe (and possibly other bits
from the dbus-1 package) along with the GLib libraries on Win32 (and
ditto on OS X)

Bottom line: D-Bus support can (relatively easily) be made to work on
all the platforms that we care about in GLib and GTK+. Which means
that it's actually fine to have a *hard* dependency on D-Bus in
GApplication if we wanted. Of course it's a lot easier to not use
D-Bus because in reality Win32 and OS X resources in the GLib and
D-Bus projects are just not there. And for other reasons, it's
probably better to use native frameworks for application uniqueness
*anyway* - for example, on Win 7 you want to use the native APIs for
better shell integration.

    David


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]