[Patch] MSVC fixes for dbus master

Romain Pokrzywka romain at kdab.com
Mon Feb 22 17:02:53 PST 2010


Hi,

Please find attached a couple of patches for minor fixes on windows with the msvc compiler (VS2008).

- The first patch fixes compilation errors when the option DBUS_USE_OUTPUT_DEBUG_STRING is enabled
- The second patch is a trivial warning fix, a missing return statement
- The third patch is a little more tricky: basically MSVC (as of VS2008) doesn't support exporting global variables from 
a DLL just by using the "extern" keyword, even if the variable is exported as DATA in the .def file. What you get then 
is a linker error when trying to access the variable from outside the DLL. In what was probably an attempt to work 
around those linker errors, the "DATA" keyword was removed for the variables actually accessed outside libdbus-1.dll. 
However, while this fixes the linker issue, what you're accessing in that case is not the variable but some stub which 
contains the actual variable address in memory (iow, pVar instead of *pVar), which is bound for erratic behavior and 
crashes. So the only way to access global variables properly is to use the standard dllexport/dllimport pattern.

Thanks for reviewing and committing !

Cheers
Romain

-- 
Romain Pokrzywka | romain at kdab.com | Certified Qt Software Engineer & Trainer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-small-fixes-for-DBUS_USE_OUTPUT_DEBUG_STRING-code.patch
Type: text/x-patch
Size: 1066 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20100222/dc9d1a17/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-warning.patch
Type: text/x-patch
Size: 638 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20100222/dc9d1a17/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-fix-potential-crashes-on-windows-with-MSVC-due-to-ba.patch
Type: text/x-patch
Size: 3714 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20100222/dc9d1a17/attachment-0002.bin>


More information about the dbus mailing list