GNOME Bugzilla – Bug 756053
MSVC doesn't understand the symbol 'msghdr'
Last modified: 2015-10-05 10:57:24 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.
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!
Review of attachment 312662 [details] [review]: Looks good, thanks for the fast fix.
Hi Philip, Thanks, the patch was pushed as f3a3180. With blessings.
Seems to be working here too. Thanks.