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 756053 - MSVC doesn't understand the symbol 'msghdr'
MSVC doesn't understand the symbol 'msghdr'
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
unspecified
Other Windows
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-10-04 16:15 UTC by John E
Modified: 2015-10-05 10:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gio/gsocket.c: Fix build on Windows (1.09 KB, patch)
2015-10-05 08:34 UTC, Fan, Chun-wei
accepted-commit_now Details | Review

Description John E 2015-10-04 16:15:17 UTC
When building from git master (4th Oct 2015) the file 'gio/gsocket.c' fails to compile with MSVC. I'm seeing errors in the function 'input_message_from_msghdr()'.  The errors are all broadly similar and take the following form:-

..\gio\gsocket.c (line 3961) : error C2037: left of 'msg_name' specifies undefined struct/union 'msghdr'

That function - 'input_message_from_msghdr()' - looks similar (conceptually) to 'input_message_to_msghdr()' and also to 'output_message_to_msghdr()'.  But one crucial difference is that those latter two are getting implemented as #defines (whereas the first one is getting implemented as an actual function).  AFAICT none of them actually gets used if G_OS_WIN32 is defined (although the function itself does get included in a compilation).

So perhaps the first one should be getting implemented like the other two? Or if it needs to be a function, maybe it should be getting guarded with #ifndef G_OS_WIN32?  Or should we be declaring a 'msghdr' struct somewhere?  Whatever's wrong, it looks like this happened very recently.
Comment 1 Fan, Chun-wei 2015-10-05 08:34:31 UTC
Created attachment 312662 [details] [review]
gio/gsocket.c: Fix build on Windows

Hi,

This is the patch for fixing the build on Windows, as msghdr is indeed a *NIX-only thing.

I think, though, perhaps the WinSock2 code need to be factored out to be reused in a similar fashion though?

With blessings, thank you!
Comment 2 Philip Withnall 2015-10-05 08:54:41 UTC
Review of attachment 312662 [details] [review]:

Looks good, thanks for the fast fix.
Comment 3 Fan, Chun-wei 2015-10-05 09:16:52 UTC
Hi Philip,

Thanks, the patch was pushed as f3a3180.

With blessings.
Comment 4 John E 2015-10-05 10:57:24 UTC
Seems to be working here too. Thanks.