[PATCH 1/4] include: Always use the WS_* prefix on Unix.

Zebediah Figura (she/her) zfigura at codeweavers.com
Tue Jan 11 11:57:20 CST 2022


On 1/11/22 08:14, Alexandre Julliard wrote:
> Zebediah Figura <zfigura at codeweavers.com> writes:
> 
>> From: Alexandre Julliard <julliard at winehq.org>
>>
>> This removes the ability to use Windows sockets on Unix.
>>
>> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52250
>> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
>> ---
>>
>> Extended from the original revision to include all headers that interpret
>> USE_WS_PREFIX, not just the main socket ones. Note that in particular inaddr.h
>> can be included by iphlpapi.h without requiring winsock.h or winsock2.h.
> 
> This breaks non-Mingw builds. We could change all the places that
> include winsock2.h before msvcrt headers but that's not a great
> solution...
> 
> clang -m64 -c -o dlls/dhcpcsvc/tests/dhcpcsvc.o ../wine/dlls/dhcpcsvc/tests/dhcpcsvc.c -Idlls/dhcpcsvc/tests \
>    -I../wine/dlls/dhcpcsvc/tests -Iinclude -I../wine/include -I../wine/include/msvcrt -D__WINESRC__ \
>    -D_MSVCR_VER=0 -fPIC -fasynchronous-unwind-tables -D_WIN32 -fno-builtin -fshort-wchar -mabi=ms \
>    -Wall -pipe -fcf-protection=none -fno-stack-protector -fno-strict-aliasing \
>    -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Winit-self -Wno-pragma-pack \
>    -Wstrict-prototypes -Wtype-limits -Wvla -Wwrite-strings -Wpointer-arith -gdwarf-4 -g -O2 -Wno-enum-conversion -Wno-sometimes-uninitialized -Wno-ignored-attributes -Wno-array-bounds -Wno-absolute-value -Wno-incompatible-pointer-types
> ../wine/dlls/dhcpcsvc/tests/dhcpcsvc.c:33:37: error: use of undeclared identifier 'AF_UNSPEC'
>          err = GetAdaptersAddresses( AF_UNSPEC, GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST |
>                                      ^
> 1 error generated.
> make: *** [Makefile:61889: dlls/dhcpcsvc/tests/dhcpcsvc.o] Error 1
> 

Ah, I didn't realize that __WINE_USE_MSVCRT was a symbol defined by the 
msvcrt headers. I see a few potential solutions for this:

* define __WINE_USE_MSVCRT via winegcc and configure instead,

* use __MSVCRT__ instead, which already is? It's not clear to me the 
exact semantics of this symbol, though; it seems to have some meaning 
outside of Wine?

* just append "&& !defined(__WINESRC__)" in the condition in this patch, 
which doesn't seem great;

* include msvcrt headers in winsock headers; this seems like probably a 
bad idea.

Do any of these seem like a best solution, or are there reasons one or 
more won't work that I haven't anticipated?



More information about the wine-devel mailing list