Is there any way to use getaddrinfo() and freeaddrinfo() and still be the program compatible with legacy versions of Windows?
in the Winsock2 library getaddrinfo()
and freeaddrinfo()
was only added in Windows XP and on. I know how to replace them in legacy systems, but a conditional use depending on the Windows version won't help.
The a开发者_JS百科pplication won't start in 9x with a message saying that it was linked to a missing export in WS2_32.dll.
I'm using MinGW to compile and link the code and would like to keep using it. Maybe writing those functions by myself?
Thank you very much for everything.
You can use LoadLibrary
and GetProcAddress
to (attempt to) get the addresses of getaddrinfo
and freeaddrinfo
, then call them via the pointers iff GetProcAddress
returns a non-NULL pointer.
精彩评论