1 <refentry id="gdbus-codegen" lang="en">
5 <productname>GIO</productname>
8 <contrib>Developer</contrib>
9 <firstname>David</firstname>
10 <surname>Zeuthen</surname>
11 <email>zeuthen@gmail.com</email>
17 <refentrytitle>gdbus-codegen</refentrytitle>
18 <manvolnum>1</manvolnum>
19 <refmiscinfo class="manual">User Commands</refmiscinfo>
23 <refname>gdbus-codegen</refname>
24 <refpurpose>D-Bus code and documentation generator</refpurpose>
29 <command>gdbus-codegen</command>
30 <arg><option>-h</option>, <option>--help</option></arg>
31 <arg><option>--interface-prefix</option> <replaceable>org.project.Prefix</replaceable></arg>
32 <arg><option>--generate-c-code</option> <replaceable>OUTFILES</replaceable></arg>
33 <arg><option>--c-namespace</option> <replaceable>YourProject</replaceable></arg>
34 <arg><option>--c-generate-object-manager</option></arg>
35 <arg><option>--c-generate-autocleanup</option> none|objects|all</arg>
36 <arg><option>--output-directory</option> <replaceable>OUTDIR</replaceable></arg>
37 <arg><option>--generate-docbook</option> <replaceable>OUTFILES</replaceable></arg>
38 <arg><option>--xml-files</option> <replaceable>FILE</replaceable></arg>
39 <group choice="plain" rep="repeat">
41 <option>--annotate</option>
42 <replaceable>ELEMENT</replaceable>
43 <replaceable>KEY</replaceable>
44 <replaceable>VALUE</replaceable>
47 <arg choice="plain">FILE</arg>
49 <arg choice="plain" rep="repeat">FILE</arg>
55 <title>Description</title>
57 <command>gdbus-codegen</command> is used to generate code and/or
58 documentation for one or more D-Bus interfaces. The tool reads
60 url="http://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format">D-Bus
61 Introspection XML</ulink> files and generates output files. The
62 tool currently supports generating C code (via
63 <option>--generate-c-code</option>) and Docbook XML (via
64 <option>--generate-docbook</option>).
69 <title>Generating C code</title>
71 When generating C code, a
72 #GInterface<!-- -->-derived type is generated for each D-Bus
73 interface. Additionally, for every generated type,
74 <type>FooBar</type>, two concrete instantiable types,
75 <type>FooBarProxy</type> and <type>FooBarSkeleton</type>, implementing
76 said interface are also generated. The former is derived from
77 #GDBusProxy and intended for use on the client side
78 while the latter is derived from the
79 #GDBusInterfaceSkeleton type making it easy to export on a
80 #GDBusConnection either directly or via a
81 #GDBusObjectManagerServer instance.
84 The name of each generated C type is derived from the D-Bus
85 interface name stripped with the prefix given with
86 <option>--interface-prefix</option> and with the dots removed and
87 initial characters capitalized. For example, for the D-Bus
88 interface <literal>com.acme.Coyote</literal> the name used is
89 <literal>ComAcmeCoyote</literal>. For the D-Bus interface
90 <literal>org.project.Bar.Frobnicator</literal> with
91 <option>--interface-prefix</option>
92 <literal>org.project.</literal>, the name used is
93 <literal>BarFrobnicator</literal>.
96 For methods, signals and properties, if not specified, the name
97 defaults to the name of the method, signal or property.
100 Two forms of the name are used - the CamelCase form and the
101 lower-case form. The CamelCase form is used for the #GType and
102 struct name, while lower-case form is used in function names. The
103 lower-case form is calculated by converting from CamelCase to
104 lower-case and inserting underscores at word boundaries (using
108 If the value given by the <literal>org.gtk.GDBus.C.Name</literal>
109 annotation or the <option>--c-namespace</option> option contains
110 an underscore (sometimes called <emphasis>Ugly_Case</emphasis>),
111 then the camel-case name is derived by removing all underscores,
112 and the lower-case name is derived by lower-casing the
113 string. This is useful in some situations where abbreviations are
114 used. For example, if the annotation is used on the interface
115 <literal>net.MyCorp.MyApp.iSCSITarget</literal> with the value
116 <literal>iSCSI_Target</literal> the CamelCase form is
117 <literal>iSCSITarget</literal> while the lower-case form is
118 <literal>iscsi_target</literal>. If the annotation is used on the
119 method <literal>EjectTheiPod</literal> with the value
120 <literal>Eject_The_iPod</literal>, the lower-case form is
121 <literal>eject_the_ipod</literal>.
126 <title>Generating Docbook documentation</title>
128 Each generated Docbook XML file (see the
129 <option>--generate-docbook</option> option for details) is a <ulink
130 url="http://www.docbook.org/tdg/en/html/refentry.html"><literal>RefEntry</literal></ulink>
131 article describing the D-Bus interface.
136 <title>Options</title>
138 The following options are supported:
143 <term><option>-h</option>, <option>--help</option></term>
152 <term><option>--xml-files</option> <replaceable>FILE</replaceable></term>
155 The D-Bus introspection XML file.
161 <term><option>--interface-prefix</option> <replaceable>org.project.Prefix.</replaceable></term>
164 A prefix to strip from all D-Bus interface names when
165 calculating the typename for the C binding and the Docbook
167 url="http://www.docbook.org/tdg/en/html/primary.html">sortas
174 <term><option>--generate-docbook</option> <replaceable>OUTFILES</replaceable></term>
177 Generate Docbook Documentation for each D-Bus interface and
178 put it in <filename>OUTFILES-NAME.xml</filename> where
179 <literal>NAME</literal> is a place-holder for the interface
180 name, e.g. <literal>net.Corp.FooBar</literal> and so on.
186 <term><option>--generate-c-code</option> <replaceable>OUTFILES</replaceable></term>
189 Generate C code for all D-Bus interfaces and put it in
190 <filename>OUTFILES.c</filename> and
191 <filename>OUTFILES.h</filename> including any sub-directories. If you want the files to
192 be output in a different location use <option>--output-directory</option> as <filename>OUTFILES.h</filename>
193 including sub-directories will be referenced from <filename>OUTFILES.c</filename>.
196 The full paths would then be <literal>$(OUTDIR)/$(dirname $OUTFILES)/$(basename $OUTFILES).{c,h}</literal>.
202 <term><option>--c-namespace</option> <replaceable>YourProject</replaceable></term>
205 The namespace to use for generated C code. This is expected
207 url="http://en.wikipedia.org/wiki/CamelCase">CamelCase</ulink>
208 or <emphasis>Ugly_Case</emphasis> (see above).
214 <term><option>--c-generate-object-manager</option></term>
217 If this option is passed, suitable #GDBusObject,
218 #GDBusObjectProxy, #GDBusObjectSkeleton and
219 #GDBusObjectManagerClient subclasses are generated.
225 <term><option>--c-generate-autocleanup</option> none|objects|all</term>
228 This option influences what types autocleanup functions are
229 generated for. 'none' means to not generate any autocleanup functions.
230 'objects' means to generate them for object types, and 'all' means to
231 generate them for object types and interfaces. The default is 'objects'
232 due to a corner case in backwards compatibility with a few projects,
233 but you should likely switch your project to use 'all'.
234 This option was added in GLib 2.50.
240 <term><option>--output-directory</option> <replaceable>OUTDIR</replaceable></term>
243 Directory to output generated source to. Equivalent to changing directory before generation.
249 <term><option>--annotate</option> <replaceable>ELEMENT</replaceable> <replaceable>KEY</replaceable> <replaceable>VALUE</replaceable></term>
252 Used to inject D-Bus annotations into the given XML
253 files. It can be used with interfaces, methods, signals,
254 properties and arguments in the following way:
256 <informalexample><programlisting><![CDATA[
257 gdbus-codegen --c-namespace MyApp \
258 --generate-c-code myapp-generated \
259 --annotate "org.project.InterfaceName" \
260 org.gtk.GDBus.C.Name MyFrobnicator \
261 --annotate "org.project.InterfaceName:Property" \
263 --annotate "org.project.InterfaceName.Method()" \
264 org.freedesktop.DBus.Deprecated true \
265 --annotate "org.project.InterfaceName.Method()[arg_name]" \
267 --annotate "org.project.InterfaceName::Signal" \
269 --annotate "org.project.InterfaceName::Signal[arg_name]" \
271 myapp-dbus-interfaces.xml
272 ]]></programlisting></informalexample>
274 Any UTF-8 string can be used for <replaceable>KEY</replaceable> and <replaceable>VALUE</replaceable>.
283 <title>Supported D-Bus Annotations</title>
285 The following D-Bus annotations are supported by
286 <command>gdbus-codegen</command>:
292 <term><literal>org.freedesktop.DBus.Deprecated</literal></term>
295 Can be used on any <literal><interface></literal>,
296 <literal><method></literal>,
297 <literal><signal></literal> and
298 <literal><property></literal> element to specify that
299 the element is deprecated if its value is
300 <literal>true</literal>. Note that this annotation is
301 defined in the <ulink
302 url="http://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format">D-Bus
303 specification</ulink> and can only assume the values
304 <literal>true</literal> and <literal>false</literal>. In
305 particular, you cannot specify the version that the element
306 was deprecated in nor any helpful deprecation message. Such
307 information should be added to the element documentation
311 When generating C code, this annotation is used to add
312 #G_GNUC_DEPRECATED to generated functions for the element.
315 When generating Docbook XML, a deprecation warning will
316 appear along the documentation for the element.
322 <term><literal>org.gtk.GDBus.Since</literal></term>
325 Can be used on any <literal><interface></literal>,
326 <literal><method></literal>,
327 <literal><signal></literal> and
328 <literal><property></literal> element to specify the
329 version (any free-form string but compared using a
330 version-aware sort function) the element appeared in.
333 When generating C code, this field is used to ensure
334 function pointer order for preserving ABI/API, see <xref
335 linkend="gdbus-code-stability"/>.
338 When generating Docbook XML, the value of this tag appears
339 in the documentation.
345 <term><literal>org.gtk.GDBus.DocString</literal></term>
348 A string with Docbook content for documentation. This annotation can
349 be used on <literal><interface></literal>,
350 <literal><method></literal>,
351 <literal><signal></literal>,
352 <literal><property></literal> and
353 <literal><arg></literal> elements.
359 <term><literal>org.gtk.GDBus.DocString.Short</literal></term>
362 A string with Docbook content for short/brief
363 documentation. This annotation can only be used on
364 <literal><interface></literal> elements.
370 <term><literal>org.gtk.GDBus.C.Name</literal></term>
373 Can be used on any <literal><interface></literal>,
374 <literal><method></literal>,
375 <literal><signal></literal> and
376 <literal><property></literal> element to specify the
377 name to use when generating C code. The value is expected to
379 url="http://en.wikipedia.org/wiki/CamelCase">CamelCase</ulink>
380 or <emphasis>Ugly_Case</emphasis> (see above).
386 <term><literal>org.gtk.GDBus.C.ForceGVariant</literal></term>
389 If set to a non-empty string, a #GVariant instance will
390 be used instead of the natural C type. This annotation can
391 be used on any <literal><arg></literal> and
392 <literal><property></literal> element.
398 <term><literal>org.gtk.GDBus.C.UnixFD</literal></term>
401 If set to a non-empty string, the generated code will
402 include parameters to exchange file descriptors using the
403 #GUnixFDList type. This annotation can be used on
404 <literal><method></literal> elements.
412 As an easier alternative to using the
413 <literal>org.gtk.GDBus.DocString</literal> annotation, note that
414 parser used by <command>gdbus-codegen</command> parses XML
415 comments in a way similar to <ulink
416 url="http://www.gtk.org/gtk-doc/">gtk-doc</ulink>:
417 <informalexample><programlisting><![CDATA[
420 @short_description: A short description
422 A <emphasis>longer</emphasis> description.
424 This is a new paragraph.
426 <interface name="net.corp.Bar">
429 @greeting: The docs for greeting parameter.
430 @response: The docs for response parameter.
432 The docs for the actual method.
434 <method name="FooMethod">
435 <arg name="greeting" direction="in" type="s"/>
436 <arg name="response" direction="out" type="s"/>
441 @blah: The docs for blah parameter.
442 @boo: The docs for boo parameter.
445 The docs for the actual signal.
447 <signal name="BarSignal">
448 <arg name="blah" type="s"/>
449 <arg name="boo" type="s"/>
452 <!-- BazProperty: The docs for the property. -->
453 <property name="BazProperty" type="s" access="read"/>
455 ]]></programlisting></informalexample>
458 Note that <literal><![CDATA[@since]]></literal> can be used in any inline
459 documentation bit (e.g. for interfaces, methods, signals and
460 properties) to set the <literal>org.gtk.GDBus.Since</literal>
461 annotation. For the <literal>org.gtk.GDBus.DocString</literal>
462 annotation (and inline comments), note that substrings of the form
463 <literal><![CDATA[#net.Corp.Bar]]></literal>,
464 <literal><![CDATA[net.Corp.Bar.FooMethod()]]></literal>,
465 <literal><![CDATA[#net.Corp.Bar::BarSignal]]></literal> and
466 <literal><![CDATA[#net.Corp.InlineDocs:BazProperty]]></literal> are all
467 expanded to links to the respective interface, method, signal and
469 Additionally, substrings starting with <literal>@</literal> and <literal>%</literal> characters are rendered as
470 <ulink url="http://www.docbook.org/tdg/en/html/parameter.html">parameter</ulink> and
471 <ulink url="http://www.docbook.org/tdg/en/html/constant.html">constant</ulink> respectively.
474 If both XML comments and
475 <literal>org.gtk.GDBus.DocString</literal> or
476 <literal>org.gtk.GDBus.DocString.Short</literal> annotations are
477 present, the latter wins.
482 <title>Example</title>
484 Consider the following D-Bus Introspection XML.
486 <informalexample><programlisting><![CDATA[
488 <interface name="net.Corp.MyApp.Frobber">
489 <method name="HelloWorld">
490 <arg name="greeting" direction="in" type="s"/>
491 <arg name="response" direction="out" type="s"/>
494 <signal name="Notification">
495 <arg name="icon_blob" type="ay"/>
496 <arg name="height" type="i"/>
497 <arg name="messages" type="as"/>
500 <property name="Verbose" type="b" access="readwrite"/>
506 If <command>gdbus-codegen</command> is used on this file like this:
508 <informalexample><programlisting><![CDATA[
509 gdbus-codegen --generate-c-code myapp-generated \
510 --c-namespace MyApp \
511 --interface-prefix net.corp.MyApp. \
512 net.Corp.MyApp.Frobber.xml
513 ]]></programlisting></informalexample>
516 <filename>myapp-generated.[ch]</filename> are
517 generated. The files provide an abstract
518 #GTypeInterface<!-- -->-derived type called
519 <type>MyAppFrobber</type> as well as two instantiable types with
520 the same name but suffixed with <type>Proxy</type> and
521 <type>Skeleton</type>. The generated file, roughly, contains the
522 following facilities:
524 <informalexample><programlisting><![CDATA[
525 /* GType macros for the three generated types */
526 #define MY_APP_TYPE_FROBBER (my_app_frobber_get_type ())
527 #define MY_APP_TYPE_FROBBER_SKELETON (my_app_frobber_skeleton_get_type ())
528 #define MY_APP_TYPE_FROBBER_PROXY (my_app_frobber_proxy_get_type ())
530 typedef struct _MyAppFrobber MyAppFrobber; /* Dummy typedef */
534 GTypeInterface parent_iface;
536 /* Signal handler for the ::notification signal */
537 void (*notification) (MyAppFrobber *proxy,
540 const gchar* const *messages);
542 /* Signal handler for the ::handle-hello-world signal */
543 gboolean (*handle_hello_world) (MyAppFrobber *proxy,
544 GDBusMethodInvocation *invocation,
545 const gchar *greeting);
548 /* Asynchronously calls HelloWorld() */
550 my_app_frobber_call_hello_world (MyAppFrobber *proxy,
551 const gchar *greeting,
552 GCancellable *cancellable,
553 GAsyncReadyCallback callback,
556 my_app_frobber_call_hello_world_finish (MyAppFrobber *proxy,
557 gchar **out_response,
561 /* Synchronously calls HelloWorld(). Blocks calling thread. */
563 my_app_frobber_call_hello_world_sync (MyAppFrobber *proxy,
564 const gchar *greeting,
565 gchar **out_response,
566 GCancellable *cancellable,
569 /* Completes handling the HelloWorld() method call */
571 my_app_frobber_complete_hello_world (MyAppFrobber *object,
572 GDBusMethodInvocation *invocation,
573 const gchar *response);
575 /* Emits the ::notification signal / Notification() D-Bus signal */
577 my_app_frobber_emit_notification (MyAppFrobber *object,
580 const gchar* const *messages);
582 /* Gets the :verbose GObject property / Verbose D-Bus property.
583 * Does no blocking I/O.
585 gboolean my_app_frobber_get_verbose (MyAppFrobber *object);
587 /* Sets the :verbose GObject property / Verbose D-Bus property.
588 * Does no blocking I/O.
590 void my_app_frobber_set_verbose (MyAppFrobber *object,
593 /* Gets the interface info */
594 GDBusInterfaceInfo *my_app_frobber_interface_info (void);
596 /* Creates a new skeleton object, ready to be exported */
597 MyAppFrobber *my_app_frobber_skeleton_new (void);
599 /* Client-side proxy constructors.
601 * Additionally, _new_for_bus(), _new_for_bus_finish() and
602 * _new_for_bus_sync() proxy constructors are also generated.
605 my_app_frobber_proxy_new (GDBusConnection *connection,
606 GDBusProxyFlags flags,
608 const gchar *object_path,
609 GCancellable *cancellable,
610 GAsyncReadyCallback callback,
613 my_app_frobber_proxy_new_finish (GAsyncResult *res,
616 my_app_frobber_proxy_new_sync (GDBusConnection *connection,
617 GDBusProxyFlags flags,
619 const gchar *object_path,
620 GCancellable *cancellable,
622 ]]></programlisting></informalexample>
624 Thus, for every D-Bus method, there will be three C functions for
625 calling the method, one #GObject signal for handling an incoming
626 call and one C function for completing an incoming call. For every
627 D-Bus signal, there's one #GObject signal and one C function for
628 emitting it. For every D-Bus property, two C functions are
629 generated (one setter, one getter) and one #GObject property. The
630 following table summarizes the generated facilities and where they
638 <entry>Client</entry>
639 <entry>Server</entry>
645 <entry>Use <type>MyAppFrobberProxy</type></entry>
646 <entry>Any type implementing the <type>MyAppFrobber</type> interface</entry>
649 <entry>Methods</entry>
650 <entry>Use <function>m_a_f_hello_world()</function> to call.</entry>
651 <entry>Receive via the <function>handle_hello_world()</function> signal handler. Complete the call with <function>m_a_f_complete_hello_world()</function></entry>
654 <entry>Signals</entry>
655 <entry>Connect to the <function>::notification</function> GObject signal.</entry>
656 <entry>Use <function>m_a_f_emit_notification()</function> to emit signal.</entry>
659 <entry>Properties (Reading)</entry>
660 <entry>Use <function>m_a_f_get_verbose()</function> or <parameter>:verbose</parameter>.</entry>
661 <entry>Implement #GObject<!-- -->'s <function>get_property()</function> vfunc.</entry>
664 <entry>Properties (writing)</entry>
665 <entry>Use <function>m_a_f_set_verbose()</function> or <parameter>:verbose</parameter>.</entry>
666 <entry>Implement #GObject<!-- -->'s <function>set_property()</function> vfunc.</entry>
673 <title>Client-side usage</title>
675 You can use the generated proxy type with the generated
678 <informalexample><programlisting><![CDATA[
683 proxy = my_app_frobber_proxy_new_for_bus_sync (
685 G_DBUS_PROXY_FLAGS_NONE,
686 "net.Corp.MyApp", /* bus name */
687 "/net/Corp/MyApp/SomeFrobber", /* object */
688 NULL, /* GCancellable* */
690 /* do stuff with proxy */
691 g_object_unref (proxy);
692 ]]></programlisting></informalexample>
694 Instead of using the generic #GDBusProxy facilities, one can use
695 the generated methods such as
696 <function>my_app_frobber_call_hello_world()</function> to invoke
697 the <function>net.Corp.MyApp.Frobber.HelloWorld()</function>
698 D-Bus method, connect to the
699 <function>::notification</function> GObject signal to receive
700 the <function>net.Corp.MyApp.Frobber::Notication</function>
701 D-Bus signal and get/set the
702 <parameter>net.Corp.MyApp.Frobber:Verbose</parameter> D-Bus
703 Property using either the GObject property
704 <parameter>:verbose</parameter> or the
705 <function>my_app_get_verbose()</function> and
706 <function>my_app_set_verbose()</function> methods. Use the
707 standard #GObject::notify signal to listen to property changes.
710 Note that all property access is via #GDBusProxy<!-- -->'s
711 property cache so no I/O is ever done when reading properties.
712 Also note that setting a property will cause the
713 <ulink url="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties">org.freedesktop.DBus.Properties.Set</ulink> method to be
714 called on the remote object. This call, however, is asynchronous
715 so setting a property won't block. Further, the change is
716 delayed and no error checking is possible.
721 <title>Server-side usage</title>
723 The generated <type>MyAppFrobber</type> interface is designed so
724 it is easy to implement it in a #GObject
725 subclass. For example, to handle
726 <function>HelloWorld()</function> method invocations, set the
727 vfunc for <function>handle_hello_hello_world()</function> in the
728 <type>MyAppFrobberIface</type> structure. Similary, to handle
729 the <parameter>net.Corp.MyApp.Frobber:Verbose</parameter>
730 property override the <parameter>:verbose</parameter> #GObject
731 property from the subclass. To emit a signal, use
732 e.g. <function>my_app_emit_signal()</function> or
733 g_signal_emit_by_name().
736 Instead of subclassing, it is often easier to use the generated
737 <type>MyAppFrobberSkeleton</type> subclass. To handle incoming
738 method calls, use <function>g_signal_connect()</function> with
739 the <function>::handle-*</function> signals and instead of
740 overriding #GObject<!-- -->'s
741 <function>get_property()</function> and
742 <function>set_property()</function> vfuncs, use
744 g_object_set() or the generated property
745 getters and setters (the generated class has an internal
746 property bag implementation).
748 <informalexample><programlisting><![CDATA[
750 on_handle_hello_world (MyAppFrobber *interface,
751 GDBusMethodInvocation *invocation,
752 const gchar *greeting,
755 if (g_strcmp0 (greeting, "Boo") != 0)
758 response = g_strdup_printf ("Word! You said `%s'.", greeting);
759 my_app_complete_hello_world (interface, invocation, response);
764 g_dbus_method_invocation_return_error (invocation,
766 MY_APP_ERROR_NO_WHINING,
767 "Hey, %s, there will be no whining!",
768 g_dbus_method_invocation_get_sender (invocation));
775 interface = my_app_frobber_skeleton_new ();
776 my_app_frobber_set_verbose (interface, TRUE);
778 g_signal_connect (interface,
779 "handle-hello-world",
780 G_CALLBACK (on_handle_hello_world),
786 if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (interface),
788 "/path/of/dbus_object",
793 ]]></programlisting></informalexample>
795 To facilitate atomic changesets (multiple properties changing at
796 the same time), #GObject::notify signals are queued up when
797 received. The queue is drained in an idle handler (which is called from the
798 <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
799 of the thread where the skeleton object was
800 contructed) and will cause emissions of the <ulink
801 url="http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties">org.freedesktop.DBus.Properties::PropertiesChanged</ulink>
802 signal with all the properties that have changed. Use
803 g_dbus_interface_skeleton_flush() or
804 g_dbus_object_skeleton_flush() to empty the queue
805 immediately. Use g_object_freeze_notify() and
806 g_object_thaw_notify() for atomic changesets if on a different
813 <title>C Type Mapping</title>
817 <link linkend="G-VARIANT-TYPE-BOOLEAN:CAPS">'b'</link>,
818 <link linkend="G-VARIANT-TYPE-BYTE:CAPS">'y'</link>,
819 <link linkend="G-VARIANT-TYPE-INT16:CAPS">'n'</link>,
820 <link linkend="G-VARIANT-TYPE-UINT16:CAPS">'q'</link>,
821 <link linkend="G-VARIANT-TYPE-INT32:CAPS">'i'</link>,
822 <link linkend="G-VARIANT-TYPE-UINT32:CAPS">'u'</link>,
823 <link linkend="G-VARIANT-TYPE-INT64:CAPS">'x'</link>,
824 <link linkend="G-VARIANT-TYPE-UINT64:CAPS">'t'</link> and
825 <link linkend="G-VARIANT-TYPE-DOUBLE:CAPS">'d'</link>)
827 strings (type-strings
828 <link linkend="G-VARIANT-TYPE-STRING:CAPS">'s'</link>,
829 <link linkend="G-VARIANT-TYPE-BYTESTRING:CAPS">'ay'</link>,
830 <link linkend="G-VARIANT-TYPE-OBJECT-PATH:CAPS">'o'</link> and
831 <link linkend="G-VARIANT-TYPE-SIGNATURE:CAPS">'g'</link>) and
832 arrays of string (type-strings
833 <link linkend="G-VARIANT-TYPE-STRING-ARRAY:CAPS">'as'</link>,
834 <link linkend="G-VARIANT-TYPE-OBJECT-PATH-ARRAY:CAPS">'ao'</link> and
835 <link linkend="G-VARIANT-TYPE-BYTESTRING-ARRAY:CAPS">'aay'</link>)
836 are mapped to the natural types,
837 e.g. #gboolean, #gdouble, #gint, <link linkend="gchararray">gchar*</link>,
838 <link linkend="GStrv">gchar**</link> and
839 so on. Everything else is mapped to the #GVariant
843 This automatic mapping can be turned off by using the annotation
844 <literal>org.gtk.GDBus.C.ForceGVariant</literal> - if used then a
845 #GVariant is always exchanged instead of the
846 corresponding native C type. This annotation may be convenient to
848 bytestrings (type-string <link linkend="G-VARIANT-TYPE-BYTESTRING:CAPS">'ay'</link>)
849 for data that could have embedded NUL bytes.
853 <refsect1 id="gdbus-code-stability">
854 <title>Stability Guarantees</title>
856 The generated C functions are guaranteed to not change their ABI
857 that is, if a method, signal or property does not change its
858 signature in the introspection XML, the generated C functions will
859 not change its C ABI either. The ABI of the generated instance and
860 class structures will be preserved as well.
863 The ABI of the generated #GType<!-- -->s will be preserved only if
864 the <literal>org.gtk.GDBus.Since</literal> annotation is used
865 judiciously — this is because the VTable for the #GInterface
866 relies on functions pointers for signal handlers. Specifically, if
867 a D-Bus method, property or signal or is added to a D-Bus
868 interface, then ABI of the generated #GInterface type is preserved
869 if, and only if, each added method, property signal is annotated
870 with they <literal>org.gtk.GDBus.Since</literal> annotation using
871 a greater version number than previous versions.
874 The generated C code currently happens to be annotated with <ulink
875 url="http://www.gtk.org/gtk-doc/">gtk-doc</ulink> / <ulink
876 url="https://wiki.gnome.org/Projects/GObjectIntrospection">GObject
877 Introspection</ulink> comments / annotations. The layout and
878 contents might change in the future so no guarantees about
879 e.g. <literal>SECTION</literal> usage etc. is given.
882 While the generated Docbook for D-Bus interfaces isn't expected to
883 change, no guarantees are given at this point.
886 It is important to note that the generated code should not be
887 checked into revision control systems, nor it should be included
888 in distributed source archives.
895 Please send bug reports to either the distribution bug tracker
896 or the upstream bug tracker at
897 <ulink url="https://bugzilla.gnome.org/enter_bug.cgi?product=glib">https://bugzilla.gnome.org/enter_bug.cgi?product=glib</ulink>.
902 <title>See also</title>
905 <refentrytitle>gdbus</refentrytitle><manvolnum>1</manvolnum>