Wireshark-dev: Re: [Wireshark-dev] Function getaddrinfo() vanished in one of the later commits.
From: Guy Harris <[email protected]>
Date: Fri, 4 Jan 2019 12:53:15 -0800
On Jan 4, 2019, at 3:59 AM, hdv <[email protected]> wrote:

> In the extcap plugin I'm developing I used the getaddrinfo() call to resolve hostnames. This should be favorable over gethostname() which is actually deprecated AFAIK.
> 
> The previous commit I was developing on was around june 14th, 2018 (27a1906c582b..) where it still worked, now after rebasing to the latest master commit (29bfeccc8db0..) I see the function is vanished.
> 
> This is the link error I get:
> 
> anagate-core.obj : error LNK2019: unresolved external symbol __imp_getaddrinfo referenced in function socket_open [c:\development\wsbuild64\extcap\anagate.vcxproj]
> 
> I can't find any header file where it is defined. It should be somewhere in glibc.

glibc?  Do you mean GNU libc?

If so, then it will only be in glibc if you've installed glibc on Windows.

But why are you linking with glibc when building for, and on, Windows?  Do you need to use glibc rather than the native Windows libraries?  According to the Windows documentation for getaddrinfo():

	https://docs.microsoft.com/en-us/windows/desktop/api/ws2tcpip/nf-ws2tcpip-getaddrinfo

which says

	The getaddrinfo function was added to the Ws2_32.dll on Windows XP

It's in the Ws2_32 library, so why not link with that?