#159 ws2tcpip needs winsock2

closed-fixed
nobody
header (101)
5
2010-05-02
2010-05-01
Doug Semler
No

The ws2tcpip.h header needs to include winsock2. MSDN, etc notes that only the ws2tcpip header is required to get the definitions, and the Platform SDK header also includes it.

Found it when trying to use the gnulib socket libraries, in which the configure script (M4) don't include winsock2.h prior to testing the usefulness of the ws2tcpip.h header.

Attached patch (2 liner) fixes.

Discussion

  • Doug Semler

    Doug Semler - 2010-05-01

    Include winsock2.h in ws2tcpip.h

     
  • Ozkan Sezer

    Ozkan Sezer - 2010-05-01

    It is customary to include winsock2.h before ws2tcpip.h and older PSDKs didn't include winsock2.h but the w7 version indeed does. So I have no problems with this patch.

     
  • Ozkan Sezer

    Ozkan Sezer - 2010-05-01

    Although I said that I had no problems with the suggested patch, I just wrote to bug-gnulib@gnu.org describing the problem present in their m4/sys_socket_h.m4 macro where they do only a plain AC_CHECK_HEADERS([ws2tcpip.h]) to detect the header's presence. Hopefully they would take heed and fix it.

     
  • Ozkan Sezer

    Ozkan Sezer - 2010-05-02

    I applied the patch to the trunk and to the 1.0 branch, revs. 2288 and 2289. I think this can be closed now.

     
  • Doug Semler

    Doug Semler - 2010-05-02

    Just a quick comment on the "tradition:"

    IMHO, any header that uses something declared in another header should include that other header, regardless of the "tradition" of including that other header first :)

    (And second: I never liked the original design of how to include winsock2.h :))

     
  • Doug Semler

    Doug Semler - 2010-05-02
    • status: open --> closed-fixed
     

Log in to post a comment.