gstdtlscertificate: Define _WINSOCKAPI_ before including windows.h

This avoid a build failure when compiling against OpenSSL 3.2.0. The
problem is when windows.h is included before WinSock2.h. Because
windows.h includes winsock.h[1]. Defining _WINSOCKAPI_ stops windows.h
including winsock.h.

Error:
```
[748/1041] Compiling C object ext/dtls/gstdtls.dll.p/gstdtlscertificate.c.obj
FAILED: ext/dtls/gstdtls.dll.p/gstdtlscertificate.c.obj
[...]
Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(235): error C2011: 'sockaddr': 'struct' type redefinition
Windows Kits\10\include\10.0.17763.0\um\winsock.h(482): note: see declaration of 'sockaddr'
```

[1] https://stackoverflow.com/a/1372836

Closes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3167
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5783>
This commit is contained in:
Alessandro Bono 2023-12-06 12:01:36 +01:00 committed by GStreamer Marge Bot
parent 86b277fb93
commit 8274c549ee

View file

@ -39,6 +39,7 @@
#endif
#ifdef G_OS_WIN32
#define _WINSOCKAPI_
#include <windows.h>
#ifdef X509_NAME
#undef X509_NAME