Integration / D Bus Interview Questions
How do you generate D-Bus interface bindings with gdbus-codegen?
gdbus-codegen takes an introspection-format XML description of a D-Bus interface and generates ready-to-use C source and header files implementing proxy (client-side) and skeleton (service-side) GObject classes for it, removing the need to hand-write marshaling code for every method, signal, and property.
gdbus-codegen \ --interface-prefix org.example. \ --generate-c-code example-generated \ org.example.MyService.xml
The generated proxy class exposes each remote method as a native-feeling function call, complete with correct argument types, and turns signals and property changes into GObject signals your code can connect to directly, while the generated skeleton class does the mirror-image work on the service side, dispatching incoming calls to handler functions you implement.
This is the standard way GNOME-ecosystem projects build both D-Bus clients and services in C, since it keeps the interface definition as the single source of truth and avoids the class of bugs that come from hand-written marshaling code drifting out of sync with the actual interface.
More Related questions...