Hi Yang,

All the newly defined posix constants are located in errno.h, located between 
line 91 and 132.

/* POSIX SUPPLEMENT */
#define EADDRINUSE      100
#define EADDRNOTAVAIL   101
#define EAFNOSUPPORT    102
#define EALREADY        103
#define EBADMSG         104
#define ECANCELED       105
#define ECONNABORTED    106
#define ECONNREFUSED    107
#define ECONNRESET      108
#define EDESTADDRREQ    109
#define EHOSTUNREACH    110
#define EIDRM           111
#define EINPROGRESS     112
#define EISCONN         113
#define ELOOP           114
#define EMSGSIZE        115
#define ENETDOWN        116
#define ENETRESET       117
#define ENETUNREACH     118
#define ENOBUFS         119
#define ENODATA         120
#define ENOLINK         121
#define ENOMSG          122
#define ENOPROTOOPT     123
#define ENOSR           124
#define ENOSTR          125
#define ENOTCONN        126
#define ENOTRECOVERABLE 127
#define ENOTSOCK        128
#define ENOTSUP         129
#define EOPNOTSUPP      130
#define EOTHER          131
#define EOVERFLOW       132
#define EOWNERDEAD      133
#define EPROTO          134
#define EPROTONOSUPPORT 135
#define EPROTOTYPE      136
#define ETIME           137
#define ETIMEDOUT       138
#define ETXTBSY         139
#define EWOULDBLOCK     140


Here are the lines of setup_once.h that conflicts with these constants (from 
line 365 to 417). I've marked the conflicting lines with a C (hopefully, I've 
not missed any).

  /*
   * Portable error number symbolic names defined to Winsock error codes.
   */

  #ifdef USE_WINSOCK
  #undef  EBADF            /* override definition in errno.h */
  #define EBADF            WSAEBADF
  #undef  EINTR            /* override definition in errno.h */
  #define EINTR            WSAEINTR
  #undef  EINVAL           /* override definition in errno.h */
  #define EINVAL           WSAEINVAL
C #define EWOULDBLOCK      WSAEWOULDBLOCK
C #define EINPROGRESS      WSAEINPROGRESS
C #define EALREADY         WSAEALREADY
C #define ENOTSOCK         WSAENOTSOCK
C #define EDESTADDRREQ     WSAEDESTADDRREQ
C #define EMSGSIZE         WSAEMSGSIZE
C #define EPROTOTYPE       WSAEPROTOTYPE
C #define ENOPROTOOPT      WSAENOPROTOOPT
C #define EPROTONOSUPPORT  WSAEPROTONOSUPPORT
  #define ESOCKTNOSUPPORT  WSAESOCKTNOSUPPORT
C #define EOPNOTSUPP       WSAEOPNOTSUPP
  #define EPFNOSUPPORT     WSAEPFNOSUPPORT
C #define EAFNOSUPPORT     WSAEAFNOSUPPORT
C #define EADDRINUSE       WSAEADDRINUSE
C #define EADDRNOTAVAIL    WSAEADDRNOTAVAIL
C #define ENETDOWN         WSAENETDOWN
C #define ENETUNREACH      WSAENETUNREACH
C #define ENETRESET        WSAENETRESET
C #define ECONNABORTED     WSAECONNABORTED
C #define ECONNRESET       WSAECONNRESET
C #define ENOBUFS          WSAENOBUFS
C #define EISCONN          WSAEISCONN
C #define ENOTCONN         WSAENOTCONN
  #define ESHUTDOWN        WSAESHUTDOWN
  #define ETOOMANYREFS     WSAETOOMANYREFS
C #define ETIMEDOUT        WSAETIMEDOUT
C #define ECONNREFUSED     WSAECONNREFUSED
C #define ELOOP            WSAELOOP
  #ifndef ENAMETOOLONG     /* possible previous definition in errno.h */
  #define ENAMETOOLONG     WSAENAMETOOLONG
  #endif
  #define EHOSTDOWN        WSAEHOSTDOWN
C #define EHOSTUNREACH     WSAEHOSTUNREACH
  #ifndef ENOTEMPTY        /* possible previous definition in errno.h */
  #define ENOTEMPTY        WSAENOTEMPTY
  #endif
  #define EPROCLIM         WSAEPROCLIM
  #define EUSERS           WSAEUSERS
  #define EDQUOT           WSAEDQUOT
  #define ESTALE           WSAESTALE
  #define EREMOTE          WSAEREMOTE
  #endif


For what it's worth, I've voted up the Microsoft Connect issue.

Your help is really appreciated. Don't hesitate if you need me to try an 
updated version of setup_once.h.


Cheers,

Tanguy


-----Original Message-----
From: curl-library-boun...@cool.haxx.se 
[mailto:curl-library-boun...@cool.haxx.se] On Behalf Of Yang Tse
Sent: 30 April 2010 3:04 AM
To: libcurl development
Subject: Re: Errno constants conflict on VC10

2010/4/29, Tanguy Fautre <tang...@aristechnologies.com>:

>  Has anyone tried to compile Curl-7.20.1 on VS2010 before?

It seems that you might be the first soul to attempt this ;-)

> I'm getting loads of macro redefinition errors. It appears that VC10
> is now defining several errno constants that weren't previously
> defined.

Provide here the list of macros that get redefined, and we'll try to
fix this. Depending on how MS has broken their compiler headers this
time, and depending on each macro that gets redefined the fix will be
different.

> For example:
>
>  errno.h:
>  #define EWOULDBLOCK     140
>
>  Unfortunately this conflicts with setup_once.h from Curl:
>  #define EWOULDBLOCK      WSAEWOULDBLOCK

The fix for this one will be to add a line in setup_once.h inmediately
before the one you mention undefining the errno.h defined EWOULDBLOCK.

> Setup_once.h unfortunately appears to have already naively removed the macro
> redundancy from some errno constants such as EINVAL/WSAEINVAL (there are
> a few others, and it's guaranteed their values are incompatible).

Don't take for granted that setup_once.h is the naive one here.

Provide the list of redefined macros, which header defines them in
first place and with which value and we'll adjust our headers to fix
VS2010 brokenness.

> Note 2: I've also encountered this problem with OpenSSL 1.0.0 (makes you
> wonder whether I'm the only person that has tried compiling Curl and OpenSSL
> on VC10 since the first Beta has been released).

Others have similar problems with this issue. But MS seems
sloooooooooooower fixing issues.
http://connect.microsoft.com/VisualStudio/feedback/details/509380/errno-h-socket-return-codes-now-inconsistent-with-wsagetlasterror

Even when it isn't actually a libcurl problem, we try to do our best
in providing a library and tool that can be compiled with nearly any
f*****g compiler version. So tell us the info i've requested above in
order to make libcurl compilable out of the box even with VS2010.

-- 
-=[Yang]=-
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to