Using gdbus-codegen

dbus-glib comes with dbus-binding-tool, which can produce somewhat nice client- and server-side wrappers for a D-Bus interface. With GDBus, gdbus-codegen is used and like its counterpart, it also takes D-Bus Introspection XML as input:

Example 2. Example D-Bus Introspection XML

1
FIXME: MISSING XINCLUDE CONTENT


If this XML is processed like this

1
2
3
4
5
6
gdbus-codegen --interface-prefix org.gtk.GDBus.Example.ObjectManager. \
              --generate-c-code generated-code	                      \
              --c-namespace Example 				      \
              --c-generate-object-manager			      \
              --generate-docbook generated-docs                       \
              gdbus-example-objectmanager.xml

then two files generated-code.h and generated-code.c are generated. Additionally, two XML files generated-docs-org.gtk.GDBus.Example.ObjectManager.Animal and generated-docs-org.gtk.GDBus.Example.ObjectManager.Cat with Docbook XML are generated.

While the contents of generated-code.h and generated-code.c are best described by the gdbus-codegen manual page, brief examples of how this generated code can be used can be found in ??? and ???.