On Thu, Jun 2, 2022 at 10:47 PM LIU Hao <[email protected]> wrote:

> 在 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`?
>
> Socket.xs:101:12: error: static declaration of 'inet_pton' follows
non-static declaration
 .... <some details specified>

Socket.xs:123:20: error: conflicting types for 'inet_ntop' ... <some
details specified>

>
> >> 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.
>
>
Yes - but the Perl source can direct MSVC and mingw-w64 down different
paths.
I don't exactly know why my VS 2019 builds don't need the patch .... but I
ought to work out why :-(


> My suggestion is to check for the macro `InetNtopA` like this:
>
>
Yes - that should work, and much cleaner than my attempt.
Thanks for the clear thinking !!


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

```
>

Cheers,
Rob

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

Reply via email to