gstdtlscertificate: Define _WINSOCKAPI_ before including windows.h
authorAlessandro Bono <alessandro.bono369@gmail.com>
Wed, 6 Dec 2023 11:01:36 +0000 (12:01 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 8 Dec 2023 11:28:44 +0000 (11:28 +0000)
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>

subprojects/gst-plugins-bad/ext/dtls/gstdtlscertificate.c

index 9b31464..dc16a01 100644 (file)
@@ -39,6 +39,7 @@
 #endif
 
 #ifdef G_OS_WIN32
+#define _WINSOCKAPI_
 #include <windows.h>
 #ifdef X509_NAME
 #undef X509_NAME