DBUS C++ bindings?

Aristid Breitkreuz aribrei at arcor.de
Fri Feb 24 03:04:02 PST 2006

Am Donnerstag, den 23.02.2006, 21:02 -0500 schrieb Havoc Pennington:
> I don't think there are any actively-developed C++ bindings other than
> the Qt bindings. Of course you can also just use the C API from C++.

True enough but extremely uncomfortable.

> It's not clear to me that a "C++ binding" is interesting; the idea of a
> "binding" in dbus really assumes a higher-level framework such as the
> ones in Qt, GLib, Java, C#, and so forth. These frameworks usually
> define memory management, interface introspection, main loop, threads,
> signals/slots/delegates/listeners, and other such stuff.

The "raw C++" bindings should use the C++ standard library, maybe boost
and  libsigc++ - their signals are faster than those from boost, then
again, not using signals at all would probably be best.

>  The
> lowlevelness of libdbus mostly comes from being agnostic on those kinds
> of features.

A "raw C++" binding should be agnostic regarding the main loop
implementation but not everything else. Thus it would be way less

> While "C++" per se leaves a lot unspecified, usually people writing a
> C++ app are using the Qt stack, or libstdc++/boost stack, or NSPR/XPCOM
> stack, or the Windows/COM stack, or the gtkmm stack. A binding specific
> to one of those would be a lot nicer than a "plain C++" binding.

It would probably be best to stick to the "libstdc++/boost" stack - this
is my perception of "standard C++", rather "modern standard C++". Such a
binding would optimally be main loop agnostic. This is probably way
easier and less intrusive than in C (don't want to hurt your feelings,
all C advocates around ;-) ).

Please notice that exceptions alone are worth making a wrapper around
D-BUS. Not only for fun did I wrap read(2) in a trivial wrapper which
simply calls read and - on error - throws an exception. There are many
more techniques available in C++ justifying a "raw C++" - or rather
"modern standard C++" binding.

Also, an official C++ binding would never be mandatory. And this binding
could never obsolete a Qt binding - Qt is no C++ in my eyes, or more
seriously, Qt is just so much different in style than "modern standard C
++". Other programmers don't feel comfortable with the C++ standard
library or boost... No problem, let them use the raw C bindings or
create their own bindings!

Having said all this, creating a C++ binding is still much work to do
and requires developer manpower which has to be acquired.

> Havoc


More information about the dbus mailing list