-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
zmq.h should not include winsock2.h #110
Comments
Problem is getting the SOCKET type defined to be used in zmq_pollitem_t structure. Either we include winsock2.h from zmq.h or make it obligatory for the user to include winsock2.h before including zmq.h. |
Or you just use:
And then in sources like zmq.cpp you'd include windows.hpp instead of using the winsock.h definitions from zmq.h. |
SOCKET is not an u_int. The actual type depends on platform (32/64) and IIRC the definition contains some MSVC-specific constructs. Thus, to make it work, the definition should be two layers of ifdefs checking for platform and for compiler (at least msvc, gcc/mingw and icc). |
Well. The MSVC winsock.h definition is 'unsigned int', which it typedefs as 'u_int'. On 64-bit compilers I assume it is a 'unsigned short'? I'd suggest that the simplest way to fix this is to (post 2.1) just make the change and then allow people who have icc and mingw to help define the right conditionals. This will be better than including winsock.h here (in any case the code already seems fragile, why is it including winsock.h and not doing the same as in windows.hpp:
? |
Can I revive this? Including winsock2.h puts ordering constraints on users, but only on Windows. These can break cross-platform builds and other libraries which may be unwise enough to impose similar constraints. winsock2.h is only needed for the definition of Would a pull request doing the little bit of #ifdeffery to get the same behavior without including winsock2.h be accepted? (*) |
ps I added a pull request to that effect because I need to do it anyway locally. #3681 |
Fixed by #3681 |
Forgot to fix zmq_poll set size, causing everything to crash
zmq.h includes winsock2.h which has the side-effect of defining FD_SETSIZE to be 64 for all programs that include zmq.h. This inclusion should be removed.
The text was updated successfully, but these errors were encountered: