在 2018/11/22 6:13, Marc-André Lureau 写道:
> 
> It looks like this:
> #define InetNtopA inet_ntop
> 
> should be written:
> #define inet_ntop InetNtopA
> 
> same for inet_pton (perhaps others)

To understand what happens, take a look at these lines:
```
#define InetPtonA inet_pton

WINSOCK_API_LINKAGE INT WSAAPI InetPtonW(INT Family, LPCWSTR pStringBuf,
PVOID pAddr);
WINSOCK_API_LINKAGE INT WSAAPI InetPtonA(INT Family, LPCSTR pStringBuf,
PVOID pAddr);
```

The macro `InetPtonA` precedes both declarations. Hence after
preprocessing, `InetPtonA` on the last line is replaced with
`inet_pton`, resulting in
```
WINSOCK_API_LINKAGE INT WSAAPI InetPtonW(INT Family, LPCWSTR pStringBuf,
PVOID pAddr);
WINSOCK_API_LINKAGE INT WSAAPI inet_pton(INT Family, LPCSTR pStringBuf,
PVOID pAddr);
```

And `inet_pton` is exactly declared there.


> 
> Or else, where is inet_pton() actually declared?
> 

libws2_32.a or the corresponding DLL, of course.



-- 
Best regards,
LH_Mouse

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to