Sending and receiving C structs

Havoc Pennington hp at redhat.com
Tue Oct 5 14:31:16 UTC 2004


On Tue, 2004-10-05 at 11:22 +0200, Timo Hoenig wrote:
> Hi,
> 
> what's the way to go for sending complete C structs via D-Bus?
> 
> I want to implement a library for abstraction which contains something
> like  event_send(Event)  and  Event event_receive(). The structure of
> Event  is most likely to change in the future. I am curious if it is
> possible to implement the send and receive functions independent of the
> actual definition of  Event.

Not without doing more work, since C has no introspection. So in some
way you have to pack and unpack the Event. You can do that with code
written specifically for Event, or you could create an elaborate generic
system where you keep introspection data about the struct.

Havoc




More information about the dbus mailing list