[FFmpeg-devel] [PATCH] Enable proper IPv6 functions on windows

Reimar Döffinger Reimar.Doeffinger
Fri Jan 15 23:18:40 CET 2010


On Fri, Jan 15, 2010 at 11:23:47PM +0200, Martin Storsj? wrote:
> On Fri, 15 Jan 2010, Ramiro Polla wrote:
> 
> > > so instead of just killing win9x, now you've killed win2k too?
> > >
> > > cant we have both?
> > >
> > > if WINNT=0x0501 then use xp stuff
> > > else if WINNT=0x0500 use win9x/2k stuff
> > >
> > > do the win2k users outnumber the ipv6 users?
> > 
> > From what I understand win2k will still work with --disable-network
> > (like in the documentation).
> > 
> > Martin, would it be possible and not too ugly to #ifdef out the code
> > that needs winxp so the current network support would still be
> > possible with some configure option?
> 
> Well, as the next step, I intended to send a patch adding
> 
>     check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
> 
> to the winsock part of the network section in configure. The point being 
> that if _WIN32_WINNT=0x0501 is set, the check will succeed and we will 
> link to the >= winxp getaddrinfo function, otherwise we'll set 
> HAVE_GETADDRINFO to 0 and use our fallback wrapper instead.
> 
> So if we want pre-XP compatibility configurable, we would only add 
> _WIN32_WINNT=0x0501 in that particular case - as in your initial win9x 
> patch. So, your initial approach, but perhaps renaming the mingw32-win9x 
> target os name into mingw32-win2k or something similar (mingw32-prexp?).
> 
> In my opinion, setting the platform define depending on what OS version 
> we're targeting and letting the normal configure check find out what's 
> supported and what's not is cleaner than adding even more platform 
> specific ifdefs to the network code.

May I say: WTF are you doing?
The defines do not matter one bit, just set -D_WIN32_WINNT=0x0501 and be done
with it, that is not an issue _whatsoever_.
Disabling gettaddrinfo sure is possible, but
a) no need to hack the defines for that
b) what is the big deal with just not enabling getaddrinfo with HAVE_WINSOCK2_H
and start ff_get_procaddres with
#if HAVE_WINSOCK2_H
  int WSAAPI (*wingetaddrinfo)(const char *, const char *, const struct addrinfo *, struct addrinfo **);
  HMODULE ws2mod = GetModuleHandle("ws2_32.dll");
  wingetaddrinfo = GetProcAddress(ws2mod, "getaddrinfo");
  if (wingetaddrinfo)
    return wingetaddrinfo(...);
#endif

Documentation claims GetModuleHandle needs at least win2k, but I think it works fine on win98
(otherwise using LoadLibrary is not much more effort).



More information about the ffmpeg-devel mailing list