[Kde-bindings] How to mix DCOP c++ code with C?

Jacques Pelletier jpelletier at ieee.org
Thu Sep 18 03:40:04 UTC 2008


On September 8, 2008 03:17:25 am Pau Garcia i Quiles wrote:
> Quoting Jacques Pelletier <jpelletier at ieee.org>:
> > Hi,
> >
> > I would like to use DCOP in a GTK C environment. Since the DCOP C
> > bindings seems to be dead/inactive, I would like to know if it's possible
> > to mix c++ code (for accessing DCOP) with the C code of the rest of the
> > program.
>
> Why would you want to use DCOP? It's a dead technology, replaced by
> DBUS in KDE4. There is a dbus-glib library:
> http://dbus.freedesktop.org/releases/dbus-glib/

It's for "historical" purpose rather than filling a real need. 
I already use DBUS in my program, along with other interfaces.

See http://sourceforge.net/projects/protocoltool/

>
> With regard to using C++ with C, yes it should be possible. You will
> need to write a C wrapper around the C++ library (a C function to
> access each C++ method -don't forget overloaded methods- you need to
> use) and use extern "C".

I don't know how much work this will involve. I may just decide to drop the 
DCOP interface anyway. I don't think this may eventually become useful.
If it's not too much effort, I may give this a try. I only need to send 
arbitrary strings and monitor what's received.

I've been able to compile the already existing KDE DCOP C bindings, but my 
program crashes when opening the interface. I suspect this may be caused by 
DCOP dependencies on old versions of GTK/GLIB/GDK. I don't remember the exact 
detail here.

>
> The most troublesome part might be the Qt event loop, you may need to
> build a special Qt 3 with glib event loop support. Take a look at
> http://www.scheinwelt.at/~norbertf/common_main_loop/ (totally
> unsupported and not carried by any distribution).

Thanks for the tip!


JP



More information about the Kde-bindings mailing list