New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSVC port broken following switch to winsock2 #5766
Comments
Comment author: @alainfrisch Same for mingw 64 port. |
Comment author: vouillon The piece of code using SO_SYNCHRONOUS_NONALERT was removed by commit 11966 to fix issue #5325. It was merged back into trunk from branch 4.00 by commit 12784. (It was left in branch 4.00 as a workaround to issue #5578.) If we want to keep this piece of code, we should include mswsock.h (diff below) rather than defining the symbols by hand. Is it really necessary to include io.h (from directory byterun/, not the windows header file)? This does not seem to be required by the mingw port. Maybe we should instead include windows.h rather than winbase.h in unixsupport.h? Index: otherlibs/win32unix/unixsupport.h--- otherlibs/win32unix/unixsupport.h (révision 12952) |
Comment author: @alainfrisch Thanks. Indeed, including mswsock.h is enough for the mingw port (tested with mingw 64 only). For the msvc port, we need to include something more to define HANDLE, otherwise we get: cl /nologo -D_CRT_SECURE_NO_DEPRECATE /Ox /MD -I../../byterun -I../unix -c createprocess.c Including windows.h instead of winbase.h in unixsupport.h (but not io.h) does not seem to work. |
Comment author: vouillon It's not 'HANDLE' which is not defined, but 'value'. Hence, mlvalues.h should be included before unixsupport.h in all C files. I'm to blame for this. I have attached a patch that should fix both issues. With mingw, the Windows header file direct.h included from unixsupport.h includes file io.h (from directory byterun!), which itself includes mlvalues.h... |
Comment author: @alainfrisch Thanks for the patch, I've committed it to the trunk (rev 12956). mswsock.h was also required in socket.c. What about including it from unixsupport.h? Do you see any problem? |
Comment author: vouillon I don't think there is any problem with including it in unixsupport.h. But maybe the right fix is to remove the getsockopt/setsockopt calls (reverting the corresponding part of commit 12784)? |
Comment author: @alainfrisch Well, as long as there is no nice solution implemented for #5578, I think getsockopt/setsockopt calls have to remain. |
Comment author: @damiendoligez Alain, does your commit of Jerome's patch fix the problem? Should we close this PR? |
Comment author: @alainfrisch I think so, but I haven't tried to compile under mingw 32 bit and msvc 64 bit. |
Comment author: @damiendoligez I've compiled under mingw 32 bit, with a small (unrelated) fix to otherlibs/labltk/lib/Makefile (r 12978). |
Comment author: @damiendoligez For the record, I have also compiled successfully with msvc 64-bit. |
Original bug ID: 5766
Reporter: @alainfrisch
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:08:12Z)
Resolution: fixed
Priority: normal
Severity: major
Target version: 4.01.0+dev
Category: platform support (windows, cross-compilation, etc)
Related to: #5676
Monitored by: vouillon
Bug description
Changes discussed in #5676 apparently broke the trunk, at least for the Win32 MSVC port. HANDLE, SO_OPENTYPE and SO_SYNCHRONOUS_NONALERT are no longer defined.
Error:
accept.c
accept.c(35) : error C2065: 'SO_OPENTYPE' : undeclared identifier
accept.c(39) : error C2065: 'SO_SYNCHRONOUS_NONALERT' : undeclared identifier
accept.c(40) : error C2065: 'SO_OPENTYPE' : undeclared identifier
accept.c(50) : error C2065: 'SO_OPENTYPE' : undeclared identifier
I can make things compile again by including io.h (to define HANDLE), and then defining missing SO_* symbols by hand:
===================================================================$Id$ */
--- unixsupport.h (revision 12946)
+++ unixsupport.h (working copy)
@@ -14,6 +14,7 @@
/*
#define WIN32_LEAN_AND_MEAN
+#include <io.h>
#include <wtypes.h>
#include <winbase.h>
#include <stdlib.h>
@@ -26,6 +27,10 @@
#include <wspiapi.h>
#endif
+#define SO_OPENTYPE 0x7008
+#define SO_SYNCHRONOUS_NONALERT 0x20
+
+
struct filedescr {
union {
HANDLE handle;
But I assume winsock2 does not support those flags.
Of course, including winsock.h in addition to winsock2.h does not work (many redefined symbols).
File attachments
The text was updated successfully, but these errors were encountered: