Collin Funk wrote: > I forgot that you have to link to ws2_32 even for these > functions on Windows. I'll work on fixing that today. Thanks!
Since it is easy to forget, let me update the doc regarding all these winsock functions. 2024-08-11 Bruno Haible <br...@clisp.org> doc: Update regarding Windows <winsock2.h> functions. * doc/posix-functions/accept.texi: Mention that it's declared elsewhere on native Windows. * doc/posix-functions/bind.texi: Likewise. * doc/posix-functions/connect.texi: Likewise. * doc/posix-functions/getpeername.texi: Likewise. * doc/posix-functions/getsockname.texi: Likewise. * doc/posix-functions/getsockopt.texi: Likewise. * doc/posix-functions/listen.texi: Likewise. * doc/posix-functions/recv.texi: Likewise. * doc/posix-functions/recvfrom.texi: Likewise. * doc/posix-functions/select.texi: Likewise. * doc/posix-functions/send.texi: Likewise. * doc/posix-functions/sendto.texi: Likewise. * doc/posix-functions/setsockopt.texi: Likewise. * doc/posix-functions/shutdown.texi: Likewise. * doc/posix-functions/socket.texi: Likewise. * doc/pastposix-functions/gethostbyaddr.texi: Don't say that the function is missing on native Windows. * doc/pastposix-functions/gethostbyname.texi: Likewise. * doc/posix-functions/getprotobyname.texi: Likewise. * doc/posix-functions/getprotobynumber.texi: Likewise. * doc/posix-functions/getservbyname.texi: Likewise. * doc/posix-functions/getservbyport.texi: Likewise. * doc/posix-functions/htonl.texi: Likewise. * doc/posix-functions/htons.texi: Likewise. * doc/posix-functions/inet_addr.texi: Likewise. * doc/posix-functions/inet_ntoa.texi: Likewise. * doc/posix-functions/ntohl.texi: Likewise. * doc/posix-functions/ntohs.texi: Likewise. * doc/posix-functions/gethostname.texi: Update. diff --git a/doc/pastposix-functions/gethostbyaddr.texi b/doc/pastposix-functions/gethostbyaddr.texi index 556bb69c90..c2822a1cd3 100644 --- a/doc/pastposix-functions/gethostbyaddr.texi +++ b/doc/pastposix-functions/gethostbyaddr.texi @@ -14,6 +14,7 @@ Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: +This function is declared in @code{<winsock2.h>} instead of @code{<netdb.h>} +on some platforms: mingw, MSVC 14. @end itemize diff --git a/doc/pastposix-functions/gethostbyname.texi b/doc/pastposix-functions/gethostbyname.texi index 5f01377b00..fb1775575c 100644 --- a/doc/pastposix-functions/gethostbyname.texi +++ b/doc/pastposix-functions/gethostbyname.texi @@ -14,6 +14,7 @@ Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: +This function is declared in @code{<winsock2.h>} instead of @code{<netdb.h>} +on some platforms: mingw, MSVC 14. @end itemize diff --git a/doc/posix-functions/accept.texi b/doc/posix-functions/accept.texi index 2e084f7a72..fbbfc3765c 100644 --- a/doc/posix-functions/accept.texi +++ b/doc/posix-functions/accept.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), the descriptors returned by the @code{accept} function cannot be used in calls to @code{read}, @code{write}, and @code{close}; you have to use @code{recv}, @code{send}, diff --git a/doc/posix-functions/bind.texi b/doc/posix-functions/bind.texi index a7f225a305..0e607070bc 100644 --- a/doc/posix-functions/bind.texi +++ b/doc/posix-functions/bind.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/connect.texi b/doc/posix-functions/connect.texi index a24499c0ce..8b0e2e07b5 100644 --- a/doc/posix-functions/connect.texi +++ b/doc/posix-functions/connect.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/gethostname.texi b/doc/posix-functions/gethostname.texi index f2368194d6..2e099292be 100644 --- a/doc/posix-functions/gethostname.texi +++ b/doc/posix-functions/gethostname.texi @@ -9,8 +9,8 @@ Portability problems fixed by Gnulib: @itemize @item -This function is declared in a different header file (namely, -@code{<winsock2.h>}) on some platforms: +This function is declared in @code{<winsock2.h>} instead of @code{<unistd.h>} +on some platforms: MSVC 14. @item On mingw and MSVC 14, this function has a prototype that differs from that diff --git a/doc/posix-functions/getpeername.texi b/doc/posix-functions/getpeername.texi index 78d9f217f6..a02df57702 100644 --- a/doc/posix-functions/getpeername.texi +++ b/doc/posix-functions/getpeername.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/getprotobyname.texi b/doc/posix-functions/getprotobyname.texi index 4152e0a8df..ab1d21059a 100644 --- a/doc/posix-functions/getprotobyname.texi +++ b/doc/posix-functions/getprotobyname.texi @@ -13,6 +13,7 @@ Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: +This function is declared in @code{<winsock2.h>} instead of @code{<netdb.h>} +on some platforms: mingw, MSVC 14. @end itemize diff --git a/doc/posix-functions/getprotobynumber.texi b/doc/posix-functions/getprotobynumber.texi index 64c9e83abc..e0ed2bdaeb 100644 --- a/doc/posix-functions/getprotobynumber.texi +++ b/doc/posix-functions/getprotobynumber.texi @@ -13,6 +13,7 @@ Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: +This function is declared in @code{<winsock2.h>} instead of @code{<netdb.h>} +on some platforms: mingw, MSVC 14. @end itemize diff --git a/doc/posix-functions/getservbyname.texi b/doc/posix-functions/getservbyname.texi index 40c20bf83d..3e5ea8efc0 100644 --- a/doc/posix-functions/getservbyname.texi +++ b/doc/posix-functions/getservbyname.texi @@ -13,6 +13,7 @@ Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: +This function is declared in @code{<winsock2.h>} instead of @code{<netdb.h>} +on some platforms: mingw, MSVC 14. @end itemize diff --git a/doc/posix-functions/getservbyport.texi b/doc/posix-functions/getservbyport.texi index d10d73e2d0..0034ce69c7 100644 --- a/doc/posix-functions/getservbyport.texi +++ b/doc/posix-functions/getservbyport.texi @@ -13,6 +13,7 @@ Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: +This function is declared in @code{<winsock2.h>} instead of @code{<netdb.h>} +on some platforms: mingw, MSVC 14. @end itemize diff --git a/doc/posix-functions/getsockname.texi b/doc/posix-functions/getsockname.texi index b09c4da2d3..530283d89f 100644 --- a/doc/posix-functions/getsockname.texi +++ b/doc/posix-functions/getsockname.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/getsockopt.texi b/doc/posix-functions/getsockopt.texi index 4f09ff10ad..03e0eb0799 100644 --- a/doc/posix-functions/getsockopt.texi +++ b/doc/posix-functions/getsockopt.texi @@ -11,6 +11,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/htonl.texi b/doc/posix-functions/htonl.texi index a4411b4206..2a5c79bc75 100644 --- a/doc/posix-functions/htonl.texi +++ b/doc/posix-functions/htonl.texi @@ -10,7 +10,11 @@ @itemize @item This function is missing on some platforms: -HP-UX 11, mingw, MSVC 14, Android 4.4. +HP-UX 11, Android API level 20. +@item +This function is declared in @code{<winsock2.h>} instead of @code{<arpa/inet.h>} +on some platforms: +mingw, MSVC 14. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/htons.texi b/doc/posix-functions/htons.texi index ee413f223f..35b66d334c 100644 --- a/doc/posix-functions/htons.texi +++ b/doc/posix-functions/htons.texi @@ -10,7 +10,11 @@ @itemize @item This function is missing on some platforms: -HP-UX 11, mingw, MSVC 14, Android 4.4. +HP-UX 11, Android API level 20. +@item +This function is declared in @code{<winsock2.h>} instead of @code{<arpa/inet.h>} +on some platforms: +mingw, MSVC 14. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/inet_addr.texi b/doc/posix-functions/inet_addr.texi index 2cc85eeaab..e6a0893657 100644 --- a/doc/posix-functions/inet_addr.texi +++ b/doc/posix-functions/inet_addr.texi @@ -13,7 +13,8 @@ Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: +This function is declared in @code{<winsock2.h>} instead of @code{<arpa/inet.h>} +on some platforms: mingw, MSVC 14. @item POSIX.1-2024 says this function is obsolescent and it is planned to be diff --git a/doc/posix-functions/inet_ntoa.texi b/doc/posix-functions/inet_ntoa.texi index 6ad1e5cf29..d6989b02d2 100644 --- a/doc/posix-functions/inet_ntoa.texi +++ b/doc/posix-functions/inet_ntoa.texi @@ -13,7 +13,8 @@ Portability problems not fixed by Gnulib: @itemize @item -This function is missing on some platforms: +This function is declared in @code{<winsock2.h>} instead of @code{<arpa/inet.h>} +on some platforms: mingw, MSVC 14. @item POSIX.1-2024 says this function is obsolescent and it is planned to be diff --git a/doc/posix-functions/listen.texi b/doc/posix-functions/listen.texi index d1e3bb4e36..248727466d 100644 --- a/doc/posix-functions/listen.texi +++ b/doc/posix-functions/listen.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/ntohl.texi b/doc/posix-functions/ntohl.texi index 17b6163325..c4b5a0126d 100644 --- a/doc/posix-functions/ntohl.texi +++ b/doc/posix-functions/ntohl.texi @@ -10,7 +10,11 @@ @itemize @item This function is missing on some platforms: -HP-UX 11, mingw, MSVC 14, Android 4.4. +HP-UX 11, Android API level 20. +@item +This function is declared in @code{<winsock2.h>} instead of @code{<arpa/inet.h>} +on some platforms: +mingw, MSVC 14. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/ntohs.texi b/doc/posix-functions/ntohs.texi index 2fe65fdb6b..b9a7450d7a 100644 --- a/doc/posix-functions/ntohs.texi +++ b/doc/posix-functions/ntohs.texi @@ -10,7 +10,11 @@ @itemize @item This function is missing on some platforms: -HP-UX 11, mingw, MSVC 14, Android 4.4. +HP-UX 11, Android API level 20. +@item +This function is declared in @code{<winsock2.h>} instead of @code{<arpa/inet.h>} +on some platforms: +mingw, MSVC 14. @end itemize Portability problems not fixed by Gnulib: diff --git a/doc/posix-functions/recv.texi b/doc/posix-functions/recv.texi index b5dffe39b1..9d75a327df 100644 --- a/doc/posix-functions/recv.texi +++ b/doc/posix-functions/recv.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/recvfrom.texi b/doc/posix-functions/recvfrom.texi index a71cd2d7ed..2bd773a33c 100644 --- a/doc/posix-functions/recvfrom.texi +++ b/doc/posix-functions/recvfrom.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/select.texi b/doc/posix-functions/select.texi index 154fc7f743..79b0d877b3 100644 --- a/doc/posix-functions/select.texi +++ b/doc/posix-functions/select.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/select.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), @code{select} can only be called on descriptors created by the @code{socket} function, not on regular file descriptors. diff --git a/doc/posix-functions/send.texi b/doc/posix-functions/send.texi index 88ddfdc775..d25628df6c 100644 --- a/doc/posix-functions/send.texi +++ b/doc/posix-functions/send.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/sendto.texi b/doc/posix-functions/sendto.texi index 49e9c87078..d5f160006a 100644 --- a/doc/posix-functions/sendto.texi +++ b/doc/posix-functions/sendto.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/setsockopt.texi b/doc/posix-functions/setsockopt.texi index ba8d6ec1b7..348ca8c0b1 100644 --- a/doc/posix-functions/setsockopt.texi +++ b/doc/posix-functions/setsockopt.texi @@ -11,6 +11,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/shutdown.texi b/doc/posix-functions/shutdown.texi index ec6a3d45c9..8b531791f7 100644 --- a/doc/posix-functions/shutdown.texi +++ b/doc/posix-functions/shutdown.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), error codes from this function are not placed in @code{errno}, and @code{WSAGetLastError} must be used instead. diff --git a/doc/posix-functions/socket.texi b/doc/posix-functions/socket.texi index 4ec8b0626f..d0211767cc 100644 --- a/doc/posix-functions/socket.texi +++ b/doc/posix-functions/socket.texi @@ -9,6 +9,11 @@ Portability problems fixed by Gnulib: @itemize @item +This function is declared in @code{<winsock2.h>} +instead of @code{<sys/socket.h>} +on some platforms: +mingw, MSVC 14. +@item On Windows platforms (excluding Cygwin), the descriptors returned by the @code{socket} function cannot be used in calls to @code{read}, @code{write}, and @code{close}; you have to use @code{recv}, @code{send},