passing NULL with Glib interface

John (J5) Palmieri johnp at redhat.com
Mon Nov 7 10:09:48 PST 2005


On Mon, 2005-11-07 at 11:14 +0000, Robert McQueen wrote:
> John (J5) Palmieri wrote:
> > Hey, this is not a bug.  You can't send NULL.  This is because D-Bus is
> > language neutral and NULL means different things.  For instance NULL in
> > C can only be applied to pointers where as the None in Python is just
> > another type that can be assigned to any variable.
> 
> Sending a string containing NULL isn't going to work, but this looks
> suspicious for the STRV though. In C a STRV needs to be NULL-terminated,
> so a D-Bus array with type "as" containing "foo" and "bar" should be
> sent as {"foo", "bar", NULL} and come out as {"foo", "bar", NULL} at the
> other end. Is this the case?

Yes this is how it works in the GLib bindings but it is an
implementation detail and not a rule of the bus (i.e. python will just
send a list and the glib bindings will decode it as a Null terminated
array of strings).  In this case we are not passing NULL's over the bus
it is just how the binding marshals them.
  
-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list