开发者

Is there any way to use getaddrinfo() and freeaddrinfo() and still be the program compatible with legacy versions of Windows?

开发者 https://www.devze.com 2022-12-24 00:21 出处:网络
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\'

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消