[Python-Dev] Handling support for newer OS features at run time
Trent Nelson
trent at snakebite.org
Wed Nov 28 00:30:28 CET 2012
On Tue, Nov 27, 2012 at 03:14:00PM -0800, Richard Oudkerk wrote:
> On 27/11/2012 10:49pm, Trent Nelson wrote:
> > Ideally, a Windows binary should make WSAPoll/select.poll()
> > available if running on Vista or above, without impacting
> > the ability to run on XP.
>
> I assume you can do something like
>
> int WSAAPI (*pWSAPoll)(WSAPOLLFD *, ULONG, INT);
> HINSTANCE hWinsock2 = GetModuleHandle("WS2_32");
> *(FARPROC *)&pWSAPoll = GetProcAddress(hWinsock2, "WSAPoll");
> if (pWSAPoll == NULL)
> ...
>
> to get a function pointer for WSAPoll on versions which support it.
Ah! Good point, that's probably a much better approach in this
instance, given I only need one or two more symbols. Thanks!
Trent.
More information about the Python-Dev
mailing list