List of tweaks required for dbus-glib build for Visual Studio 2008

Bruce, Henry henry.bruce at intel.com
Fri Jun 26 10:45:21 PDT 2009


I've just made a build of dbus-glib for Visual Studio 2008 (using winDBus).

I just had to do a few tweaks to make this work
*       Use config.h file generated on Linux build (I have a Core 2 Duo machine running Fedora 10)
*       Create an empty unistd.h include file
*       Link against libintl-proxy
*       A code change in dbus-gvalue.c.

A question to the maintainers - is his code change worthy of a check-in ? Or does someone have a better workaround ? See details below.

Code change was in dbus-gvalue.c in demarshal_strv(). C does not accept variable declarations after statements, so the following code causes the Microsoft compiler to generate error C2143: syntax error : missing ';' before 'type' at the line  const char *str; (see snippet below)


  while ((current_type = dbus_message_iter_get_arg_type (&subiter)) != DBUS_TYPE_INVALID)
    {
      g_assert (current_type == DBUS_TYPE_STRING);
      const char *str;
      char *copy;

      dbus_message_iter_get_basic (&subiter, &str);
      copy = g_strdup (str);
      g_array_append_val (arr, copy);

      dbus_message_iter_next (&subiter);
    }

A simple change to put the delcrations before the other statements avoid the error (see below)

  while ((current_type = dbus_message_iter_get_arg_type (&subiter)) != DBUS_TYPE_INVALID)
    {
      const char *str;
      char *copy;
      g_assert (current_type == DBUS_TYPE_STRING);

      dbus_message_iter_get_basic (&subiter, &str);
      copy = g_strdup (str);
      g_array_append_val (arr, copy);

      dbus_message_iter_next (&subiter);
    }


Thanks,

Henry Bruce


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20090626/feac110d/attachment.htm 


More information about the dbus mailing list