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)
commit8274c549eea838f41cc133192d604d55a3da1813
tree776ab9e7af696a95b0598b096d0078f358038515
parent86b277fb936025925b7b0b5cc01bcf01a564e238
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>
subprojects/gst-plugins-bad/ext/dtls/gstdtlscertificate.c