C-API Examples

John (J5) Palmieri johnp at redhat.com
Thu May 4 10:50:21 PDT 2006


On Wed, 2006-05-03 at 16:15 -0700, Kosina, Martin wrote:
> Hi all,
> 
> Does anyone have good working examples of using the C API ? (Sample
> client/server type scenarios, ideally). We are exploring a binding for a
> custom component system and would like to utilize the C API directly.
> I've seen lots of Glib and Qt stuff, but the low-level examples are a
> bit harder to come by. (I do have John Palmieri's "Get on D-bus"
> article, but having hard time getting it to work properly (is
> "ListServices" still exported by org.freedesktop.Dbus ?) and would like
> to see a simple server-side one, as well.

Hey,

That article is for RHEL-4, FC-3 and is based on version 0.23 of D-Bus.
Things have change a lot since then (for instance change every place you
see service with name -- i.e. ListServices -> ListNames).  What version
are you targeting?

Matthew Johnson posted his tutorial which is really good with the caveat
that it does not use mainloops and filter functions.  Some simple
example code can be seen in gnome-volume-manager which uses the glib
mainloop.  If you are not going to use a mainloop Matthew's tutorial is
a good start but most complicated programs will need a mainloop in which
case if you do not choose the glib or Qt mainloop you will have to end
up integrating d-bus into your own mainloop.  I've heard it is anything
but trivial.
  
-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list