structs, custom type

Olivier Andrieu
Wed Mar 10 18:51:31 PST 2004

 Havoc Pennington [Wednesday 10 March 2004] :
 > Hi,
 > I forgot one of the main issues with structs, that they have no
 > good C/C++ binding without causing IPC type system to leak all over
 > the place.
 > What DCOP does here is say you have a struct Point { int x, int y}
 > they just do a custom type:
 >  name = Point
 >  binary data = serialized x, y
 > So the idea with dbus today was that if you have a complex datatype
 > or struct you'd simply specify a name like org.freedesktop.Point,
 > specify the format in the byte array of DBUS_TYPE_CUSTOM, and
 > bindings would have to be specifically aware of the complex
 > datatype or allow an escape hatch through to apps so apps could be
 > specifically aware of it.

That's a weird idea (I think) : I thought the DBUS_TYPE_CUSTOM was
intended for application-specific binary data. If you start to put
dbus typecodes in the CUSTOM data that means apps (and bindings) will
have to be aware of the dbus protocol (typecodes, data representation,

 > Otherwise you have to have a DAny/DVariant object that has all the
 > same unpacking iterators found on DBusMessage, so you can bind
 > structs to that in C.

Sure, what's the problem ? We already have iterators for messages. And
a struct/tuple is conceptually not different : just a sub-collection
of values. 


More information about the dbus mailing list