Fix the #include of winsock2.h in win32/include/sys/errno2.h
authorSteve Hay <steve.m.hay@googlemail.com>
Sat, 7 Sep 2013 20:53:35 +0000 (21:53 +0100)
committerSteve Hay <steve.m.hay@googlemail.com>
Mon, 16 Sep 2013 14:37:36 +0000 (15:37 +0100)
commit4eaf3102d69324863df3d6e00970832384cdf452
treea9b608feef6f22e15d613ab5160705e08afb2906
parent7b9b1b4e943aea8e8d16d497f20e2d3366df5eae
Fix the #include of winsock2.h in win32/include/sys/errno2.h

For some reason (I didn't figure out why) cpan/Win32/Win32.xs did not
compile as of the previous commit, but in any case we cannot just blindly
include winsock2.h because (a) it is too late if winsock.h has already
been included and (b) early WinCE doesn't have it.

The definition of _WINSOCKAPI_ was also wrongly not updated to _WINSOCK2API_
but was mistaken in its comment "Don't drag in everything" anyway: it's
actually just an old-fashioned "include guard", not a means to include a
minimal API from the file. (The mistaken comment came from the original
ext/Errno/Errno_pm.PL before this round of $!-related changes. That file
also had a redundant "#include <winsock.h>" left in it which should have
been removed along with earlier work that removed the other one, so tidy
that up too.)

Steal a hopefully more correct incantation from win32/include/sys/socket.h
instead.

Now that we allow for the possibility of winsock.h being used again, we
must take care not to make use of WSAECANCELLED if it is not defined.
(That is the only WSAExxx constant which we use that was new in winsock2.h.)
ext/Errno/Errno_pm.PL
win32/include/sys/errno2.h
win32/win32sck.c