Skip to content
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

Compile fix for Visual C++ Update 3 #22

Closed
wants to merge 4 commits into from

Conversation

MarcelRaad
Copy link
Contributor

Starting with Visual C++ Update 3 RC, WSAAddressToStringA and gethostbyaddr are deprecated.
This leads to compiler warnings which are treated as an error with the /sdl switch (which is enabled by default for new projects):

error C4996: 'WSAAddressToStringA': Use WSAAddressToStringW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
error C4996: 'gethostbyaddr': Use getnameinfo() or GetNameInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings

This change calls WSAAddressToStringW instead of WSAAddressToStringA for Visual C++ 2013 and later.

MarcelRaad and others added 4 commits July 2, 2014 23:07
Starting with Visual C++ Update 3 RC, WSAAddressToStringA is deprecated.
This leads to a compiler warning which is treated as an error with the /sdl switch (which is enabled by default for new projects):
error C4996: 'WSAAddressToStringA': Use WSAAddressToStringW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
This change calls WSAAddressToStringW instead of WSAAddressToStringA for Visual C++ 2013 and later.
inet_addr is also deprecated, replaced by socket_ops::inet_pton.
@chriskohlhoff
Copy link
Owner

Perhaps this should be reported to MS? I didn't think service packs were supposed to break previously valid code.

@MarcelRaad
Copy link
Contributor Author

Of course you're right. Unfortunately the breakage is actually in the updated Windows SDK and everything I've ever seen reported on Microsoft Connect about the Windows SDK got immediately closed as "external", so I have no idea where to report this.

@chriskohlhoff
Copy link
Owner

Fixed in 3389cb9.

@MarcelRaad MarcelRaad deleted the patch-2 branch July 26, 2014 10:14
VemundH added a commit to VemundH/asio that referenced this pull request Sep 7, 2014
This is basically the same issue as fixed in pull request chriskohlhoff#22. WSASocket resolves to WSASocketA unless UNICODE is defined. This is the case when building the boost source. I think using the W version should be OK (the LPWSAPROTOCOL_INFO argument is null).
@VemundH VemundH mentioned this pull request Sep 7, 2014
@ClausKlein ClausKlein mentioned this pull request Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants