Skip to content

Only export inet_xxx function if not present by os

Ralf Habacker requested to merge habacker/kdewin:mingw-header-9-fixes into master

mingw headers 9 provides inet_pton and inet_ntop functions, which let kdewin fail to compile with recent kdewin headers as shown below:

/home/test/src/kdewin/src/inet.c:44:19: error: conflicting types for 'inet_pton'
   44 | KDEWIN_EXPORT int inet_pton(int af, const char * src, void * dst)
      |                   ^~~~~~~~~
In file included from /home/test/src/kdewin/src/inet.c:24:
/usr/i686-w64-mingw32/sys-root/mingw/include/ws2tcpip.h:408:32: note: previous declaration of 'inet_pton' was here
  408 | WINSOCK_API_LINKAGE INT WSAAPI InetPtonA(INT Family, LPCSTR pStringBuf, PVOID pAddr);
      |                                ^~~~~~~~~
/home/test/src/kdewin/src/inet.c:51:27: error: conflicting types for 'inet_ntop'
   51 | KDEWIN_EXPORT const char *inet_ntop(int af, const void *src, char *dst, size_t cnt)
      |                           ^~~~~~~~~
In file included from /home/test/src/kdewin/src/inet.c:24:
/usr/i686-w64-mingw32/sys-root/mingw/include/ws2tcpip.h:401:35: note: previous declaration of 'inet_ntop' was here
  401 | WINSOCK_API_LINKAGE LPCSTR WSAAPI InetNtopA(INT Family, LPCVOID pAddr, LPSTR pStringBuf, size_t StringBufSize);
      |                                   ^~~~~~~~~
Edited by Ralf Habacker

Merge request reports