[Live-devel] EINTR, EAGAIN, EINPROGRESS, EDOULDBLOCK Compile warning
Skaarj NaPali
skaarj1 at gmail.com
Sun Aug 12 02:33:34 PDT 2012
The patch which was introduced in 2012.08.08 of live555 "solves" the
compile time problem, but leads to wrong error numbers in the binary.
The reason for this is because VS2010 does define those error
constants in "errno.h" but the Windows socket API does not use them.
The Windows socket API still returns WSAE error codes only. But the
WSAE error codes do not match the error codes which are defined
"errno.h".
There other ways to solve that problem.
You may want to compile the library code with "-DNO_SSTREAM" which is
the originator of the problem, because including of "<sstream>" in
"groupsock" library also pulls in the problematic "errno.h"
indirectly.
You can undefine any already defined constants from "errno.h" like shown below.
<<<NetCommon.h>>>
...
...
...
#define closeSocket closesocket
#ifdef EWOULDBLOCK
#undef EWOULDBLOCK
#endif
#ifdef EINPROGRESS
#undef EINPROGRESS
#endif
#ifdef EAGAIN
#undef EAGAIN
#endif
#ifdef EINTR
#undef EINTR
#endif
#define EWOULDBLOCK WSAEWOULDBLOCK
#define EINPROGRESS WSAEWOULDBLOCK
#define EAGAIN WSAEWOULDBLOCK
#define EINTR WSAEINTR
...
...
...
Personally I am using both solutions to be on the safe side.
However, the proper solution would be to map WSAE error codes to
"errno.h" error codes within "BasicUsageEnvironment::getErrno()" --
this would be the most portable and clean solution. But because not
all of the WSAE error codes do have a respective "errno.h" error code,
it would most likely again cause some quirks here and there throughout
the source code in future.
Therefore I am recommending to "undef" any existing error codes right
before defining new ones in "NetCommon.h".
More information about the live-devel
mailing list