Hi,
In the Perl source, we hard code our own implementation of inet_ntop()  and
inet_pton().
This results in a fatal compile-time error if the Windows (ws2tcpip.h)
implementation is also present.

I'm therefore looking for a portable way of detecting whether the compiler
is a mingw-w64 one && the Windows implementation of those 2 functions has
been found.

#if !defined(__MINGW64_VERSION_MAJOR) || __GNUC__ < 4 || (__GNUC__ == 4 &&
__GNUC__ < 8) || _WIN32_WINNT < 0x0600 || !defined(_WS2TCPIP_H_)
/***  the Windows implementation has not been found, and we use the Perl
one ***/
#else
/*** the Windows implementation has been found; we must hide the Perl one
***/
#endif

Does that look to be a sane way of doing it ?

Note that I'm concerned only with mingw-w64 compilers. Oddly, this issue
hasn't arisen with MS compilers - though I've tested only with Visual
Studio 2019.
I'm not obliged to care (and I don't) if the compiler in use is neither
mingw-w64 nor non-recent MS.

I noticed  in mingw-w64 ports of gcc-4.7.3, that ws2tcpip.h makes no
mention of the 2 symbols "inet_ntop" and "inet_pton", but that both symbols
are present in gcc-4.8.2.
I'm therefore guessing that the 2 symbols first turned up in the mingw-w64
port of gcc-4.8.0.
And I notice that even when they are present in ws2tcpip.h, it's only if
_WIN32__WINNT >= 0x600.

Please let me know if you see corrections or improvements that should (or
could) be made.

Cheers,
Rob

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to