DBus 1.4.6 and Git master build error on Windows

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Mar 4 03:49:02 PST 2011


On Fri, 04 Mar 2011 at 11:52:41 +0100, Andre Heinecke wrote:
> i've tried to compile DBus 1.4.6 and Git master with the mingw-w64-x86 
> compiler using the cmake buildsystem on Windows. A builderror occured in 
> config-parser.c regarding ELEMENT_TYPE

Glad to hear people are checking development versions on Windows!

> ELEMENT_TYPE is a defined enumeration in winioctl.h ( 
> http://msdn.microsoft.com/en-us/library/aa363252(v=vs.85).aspx )

Ugh, namespace pollution.

We could either fix this the way you suggest, or by avoiding including
winioctl.h (directly or indirectly) in any source file that also includes
config-parser.h. In principle only dbus-sysdeps-*.c are meant to include
OS-dependent headers, although I don't think that's strictly enforced.

git grep -i on the D-Bus source doesn't show me any mentions of winioctl,
except for this ugly workaround in config.h.cmake which is only active when
using both MSVC++ and cmake, which we can remove if this is fixed properly:

    #ifdef _MSC_VER
    /* avoid defines of ELEMENT_TYPE */
    #define _WINIOCTL_
    #endif

Is _WINIOCTL_ a documented way to disable winioctl.h, or is this (as I suspect)
just a hack? If it's a documented way to disable winioctl.h, we should make it
conditional on DBUS_WIN instead of MSVC++.

Alternatively, which chain(s) of headers indirectly include winioctl.h? How
feasible is it to just avoid config-parser and winioctl.h having to coexist?

> Attached Patch solved this problem for be but any renaming of that value 
> should do it.

Like I said on IRC, I'd be happy enough to merge this if you amended it to
add a comment something like this:

  ELEMENT_INCLUDEDIR,
  /* this is really <type>, but winioctl.h defines ELEMENT_TYPE */
  ELEMENT_CONFIGTYPE,
  ELEMENT_SELINUX,

Thanks,
    S


More information about the dbus mailing list