Richard W.M. Jones wrote: > error codes aren't compatible. > Although Gnulib tries to define its own error numbers which are > compatible with Win32 ones (eg. EINPROGRESS == 10036 == > WSAEINPROGRESS), it also uses some from the MinGW header files which > are just plain wrong (eg. ENOMEM == 12 == ERROR_INVALID_ACCESS, MinGW > gets this wrong, it should be ENOMEM 14 == ERROR_OUTOFMEMORY).
The error values returned by GetLastError() and those stored in errno are in different enumerations or "namespaces". There is no relation between them. One is a 'DWORD', the other one is an 'int'. You are responsible, after getting a value 12 from GetLastError(), for interpreting it as ERROR_INVALID_ACCESS, and if you get a value 12 from errno, for interpreting it as ENOMEM. Any system can define the possible errno values as arbitrary positive integers, with very little constraints [1]. Bruno [1] http://www.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html