InetNtop and ws2tcpip.h under GCC / Cygwin

*爱你&永不变心* 提交于 2019-12-11 17:49:04

问题


I'm using the version of ws2tcpip.h provided with gcc 3.4.4 under cygwin 2.774

I was looking up the InetNtop function, which is Microsoft's implementation of inet_ntop, however the two versions of ws2tcpip.h I found don't contain that function. Including arpa/inet.h to get inet_ntop causes all sorts of terrible to happen with overlapping definitions.

Is there a reason that the versions provided with gcc/cygwin don't have this function? Is there a (legal?) way get the version from Microsoft that has the definition?

note: I'm 100% certain I have the correct #defines, #includes, and linker options

note: Please do not suggest using the older WSA* functions I'm well aware of them.

EDIT:

Did some more digging today and have come to the conclusion that the header must be missing entries as here is the grep of the headers:

asdf@fdsa ~$ grep -i -B 4 -A 2 -R "inet_ntop" /usr/include/
/usr/include/arpa/inet.h-in_addr_t inet_netof (struct in_addr);
/usr/include/arpa/inet.h-in_addr_t inet_network (const char *);
/usr/include/arpa/inet.h-char *inet_ntoa (struct in_addr);
/usr/include/arpa/inet.h-int inet_pton (int, const char *, void *);
/usr/include/arpa/inet.h:const char *inet_ntop (int, const void *, char *, socklen_t);
/usr/include/arpa/inet.h-#endif
/usr/include/arpa/inet.h-
--
/usr/include/cygwin/version.h-      127: Export sigrelese.
/usr/include/cygwin/version.h-      128: Export pselect.
/usr/include/cygwin/version.h-      129: Export mkdtemp.
/usr/include/cygwin/version.h-      130: Export strtoimax, strtoumax, llabs, imaxabs, lldiv, imaxdiv.
/usr/include/cygwin/version.h:      131: Export inet_ntop, inet_pton.
/usr/include/cygwin/version.h-      132: Add GLOB_LIMIT flag to glob.
/usr/include/cygwin/version.h-      133: Export __getline, __getdelim.
asdf@fdsa ~$ grep -i -B 4 -A 2 -R "inetntop" /usr/include/
asdf@fdsa ~$ 

And here is the strings out of the library files:

asdf@fdsa ~$ strings /usr/lib/w32api/libws2_32.a | grep -i 'inet_*ntop'
_inet_ntop@16
__imp__inet_ntop@16
_InetNtopW@16
__imp__InetNtopW@16
inet_ntop
_inet_ntop@16
__imp__inet_ntop@16
InetNtopW
_InetNtopW@16
__imp__InetNtopW@16

Anyone know why the headers are wrong / where I can get complete ones?

来源:https://stackoverflow.com/questions/10974328/inetntop-and-ws2tcpip-h-under-gcc-cygwin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!