After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 675516 - Win32: Don't start a DBus server when built as static library
Win32: Don't start a DBus server when built as static library
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: win32
2.32.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-win32 maintainers
Depends on:
Blocks:
 
 
Reported: 2012-05-05 17:33 UTC by Erik van Pienbroek
Modified: 2013-08-25 19:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (1.46 KB, patch)
2012-05-05 17:33 UTC, Erik van Pienbroek
none Details | Review
Proposed patch (try2) (1.83 KB, patch)
2012-08-27 21:14 UTC, Erik van Pienbroek
accepted-commit_now Details | Review
win32: Fix GDBusDaemon build when glib is built as a static lib (1.05 KB, patch)
2012-12-02 17:04 UTC, Kalev Lember
none Details | Review
win32: Fix GDBusDaemon build when glib is built as a static lib (1.30 KB, patch)
2012-12-02 18:51 UTC, Kalev Lember
committed Details | Review
make glib work again on Windows 2000 (1.24 KB, patch)
2013-08-25 19:27 UTC, TS
none Details | Review

Description Erik van Pienbroek 2012-05-05 17:33:27 UTC
Created attachment 213501 [details] [review]
Proposed patch

The new Win32 DBus server code which was recently introduced works
by retrieving the path of the gio DLL and using rundll32.exe to
create a new process which starts a DBus server using the gio DLL.

This doesn't work when GLib is built as a static library as there is no
gio DLL available in that case. Therefore the code which tries to start
a DBus server using the above steps doesn't have to be executed as it
will always fail.

Attached patch makes sure that no attempt is done to start a DBus server when
using a static compiled GLib and that a proper error message is automatically
returned to the caller. This also fixes a compilation failure which occurs
when GLib is compiled as static library

Please apply to both master and 2.32 branches
Comment 1 Kalev Lember 2012-06-16 18:47:06 UTC
Review of attachment 213501 [details] [review]:

::: gio/gdbusaddress.c
@@ +1395,3 @@
   if (address == NULL)
     {
       gio_path[MAX_PATH] = 0;

Adding the #ifdef would introduce a new unused variable compiler warning for the !DLL_EXPORT case. Might be a good idea to move gio_path variable declaration down here to the "if (address == NULL)" scope to fix this.
Comment 2 Erik van Pienbroek 2012-08-27 21:14:27 UTC
Created attachment 222585 [details] [review]
Proposed patch (try2)

Resolved the unused variable warning
Comment 3 Kalev Lember 2012-12-02 17:03:09 UTC
I took another look at the patch and I think it would be better to (try to) fix the logic up so that the DBus server can actually work when gio is built as a static lib. What the proposed patches do so far is to just ifdef the code out that starts the DBus server, effectively making it useless for the static build.

I'm going to attach another patch that attempts to make it work, without killing the autostart code.
Comment 4 Kalev Lember 2012-12-02 17:04:02 UTC
Created attachment 230445 [details] [review]
win32: Fix GDBusDaemon build when glib is built as a static lib

This makes sure not to ifdef _g_io_win32_get_module() out when glib is
built as a static lib, and also fixes it to work when DllMain isn't
available.
Comment 5 Paolo Borelli 2012-12-02 17:10:30 UTC
Kalev said on irc that the last patch uses a symbol that's not available on win2k... I think that's completely fine and long overdue :)

That's said, let's at least mention it in the changelog
Comment 6 Dieter Verfaillie 2012-12-02 17:21:13 UTC
Dropping support for win2k is fine by me, and indeed long overdue.
Bug #637565 also mentions the gtk.org website and there's maybe other
stuff that would need to mention this change ?
Comment 7 Kalev Lember 2012-12-02 18:51:30 UTC
Thanks, I've updated the commit message.
Comment 8 Kalev Lember 2012-12-02 18:51:49 UTC
Created attachment 230455 [details] [review]
win32: Fix GDBusDaemon build when glib is built as a static lib

This makes sure not to ifdef _g_io_win32_get_module() out when glib is
built as a static lib, and also fixes it to work when DllMain isn't
available.

The implementation uses GetModuleHandleEx() which is only available on
Windows XP and later, so this commit effectively drops the Windows 2000
support in glib. Earlier commit 731b4699 already took care of defining
_WIN32_WINNT to support the Windows XP API.
Comment 9 Erik van Pienbroek 2012-12-02 19:07:43 UTC
I'm +1 to the patch from Kalev as well

Win2k support probably was broken for a long time already as one of the latest win2k compatibility commits - 9a88613 - only has any effect when GLib is built using the mingw-w64 toolchain or MSVC. The mingw.org toolchain doesn't provide wspiapi.h and this is the header which provides win2k compatibility for getaddrinfo, getnameinfo and freeaddrinfo
Comment 10 Dieter Verfaillie 2012-12-02 19:16:58 UTC
Review of attachment 222585 [details] [review]:

ok
Comment 11 Dieter Verfaillie 2012-12-02 19:17:48 UTC
Review of attachment 230455 [details] [review]:

ok
Comment 12 Kalev Lember 2012-12-02 19:20:57 UTC
Comment on attachment 230455 [details] [review]
win32: Fix GDBusDaemon build when glib is built as a static lib

Thanks, pushed to master as 80c24d36f2525d83e458ebbdf62fdbd085945a02
Comment 13 TS 2013-08-25 19:26:33 UTC
> Win2k support probably was broken for a long time already

Not true, I'm using glib cross compiled using fedora (so with mingw-w64) on W2K for a long time, it worked nicely.

So can this please be implemented using the attached patch?

The gnetworking.h includes are needed to pull in wspiapi.h, for the freeaddrinfo W2k compatibility.
Comment 14 TS 2013-08-25 19:27:13 UTC
Created attachment 253072 [details] [review]
make glib work again on Windows 2000