在 2022/6/2 20:37, sisyphus 写道:
On Thu, Jun 2, 2022 at 12:28 PM sisyphus <[email protected]> wrote:

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.


What's the error? Is it caused by re-declaration with a different calling convention i.e. `__stdcall` vs. `__cdecl`?


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.


This issue is not specific to mingw-w64. If MSVC was used to build Perl, there would be the same error, because we do the same.

My suggestion is to check for the macro `InetNtopA` like this:

  ```
  #ifdef InetNtopA
  /* Windows-specific stuff here.  */
  #else
  /* Linux, BSD, etc.  */
  #endif
  ```


--
Best regards,
LIU Hao

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

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

Reply via email to