#1282 Visual Studio 2010 build failed if WINVER >= 0x600 with duplicate define POLLIN for cURL 7.32.0

closed-fixed
POLLIN (1)
5
2014-08-16
2013-09-24
kdekker
No

If no WINVER and/or _WIN32_IWNNT define was set, the Windows platform SDK often defaults to high value, e.g. 0x601 (whoch may probably depend on the Windows version being used, in my case Windows 7).

If WINVER >= 0x600 then winsock2.h includes some defines for WSAPoll(), e.g. POLLIN, POLLPRI, POLLOUT etc. These defines clash with cURL's lib/select.h.

I made a minor change to get the Windows/Visual Studio build working, see diff below:

diff lib\select.h \obj.WINx64\thirdparty\cURL\curl-7.32.0\lib\select.h
39,40c39
<     !defined(HAVE_POLL_H) && \
<     !defined(_WIN32)
---
>     !defined(HAVE_POLL_H)

An additional !defined(_WIN32) was added to prevent that lib/select.h defines duplicates. Because cURL does not use WSAPoll at all (see http://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/), I think it is safe to omit these defines for Visual Studio. But if this change conflicts with other compiler on Windows, then something else need to be figured out.

Discussion

  • Marcel Raad

    Marcel Raad - 2013-09-24

    That would break the compatibility with older Windows SDKs. You only have to define HAVE_STRUCT_POLLFD.

     
  • Daniel Stenberg

    Daniel Stenberg - 2013-09-24

    Based on Marcel's advice can't we just edit config-win32.h to do that define (with a comment explaining why) as libcurl's code won't actully use poll on windows anyway?

     
  • Daniel Stenberg

    Daniel Stenberg - 2013-09-26
    • assigned_to: Daniel Stenberg
     
  • Daniel Stenberg

    Daniel Stenberg - 2013-09-26
    • status: open --> pending-needsinfo
     
  • Marcel Raad

    Marcel Raad - 2013-09-27

    I'm using the attached config-win32.h patch (I hope it's in the right format, I use SVN). I have moved the "struct related" section to below the "compiler specific" section so that I can use the _WIN32_WINNT define and added the HAVE_STRUCT_POLLFD for _WIN32_WINNT >= 0x0600 and HAVE_WINSOCK2_H, as this is the file where the definition is located.

     
  • Daniel Stenberg

    Daniel Stenberg - 2013-09-28
    • status: pending-needsinfo --> closed-fixed
     
  • Daniel Stenberg

    Daniel Stenberg - 2013-09-28

    Thanks a lot, this patch was merged and pushed as commit d5f687ed8f069ca8af4

    Case closed!

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks