This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: "#define socklen_t int" in pyconfig.h
Type: compile error Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, fgoujeon
Priority: normal Keywords:

Created on 2008-07-02 14:42 by fgoujeon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg69097 - (view) Author: (fgoujeon) Date: 2008-07-02 14:42
Hello all,

I'm using MinGW 4.2.1 and was unable to compile my code when including
pyconfig.h.

The culpables are these lines (from line 428):

/* Define to `int' if <sys/types.h> doesn't define.  */
#if 1 //_MSC_VER + 0 >= 1300
/* VC.NET typedefs socklen_t in ws2tcpip.h. */
#else
#define socklen_t int
#endif

MinGW (at least the version I use) typedefs socklen_t too, in ws2tcpip.h
(at line 272):
typedef int socklen_t;

When the #define takes effect, code becomes:
typedef socklen_t socklen_t;

...which leads to a compile error (really hard to understand):
C:/MinGW/include/ws2tcpip.h:272: error: multiple types in one declaration


I hope these details will be useful for you. I'm available for another
questions.

Thanks!
msg69098 - (view) Author: (fgoujeon) Date: 2008-07-02 14:46
Erratum:

The culpables are these lines (from line 428):
/* Define to `int' if <sys/types.h> doesn't define.  */
#if _MSC_VER + 0 >= 1300
/* VC.NET typedefs socklen_t in ws2tcpip.h. */
#else
#define socklen_t int
#endif


Sorry.
msg69100 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-07-02 15:09
This block is only to support the older VC6 compiler. Since your
installation was most certainly compiled with VS7, your change is correct.

(or better, something like:
   #if !defined(_MSC_VER) || _MSC_VER + 0 >= 1300
)

The trunk version (future 2.6) was already fixed with r64214: the
"#define socklen_t int" was moved to socketmodule.h, which is not
included in python.h.
History
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47507
2008-07-02 15:09:35amaury.forgeotdarcsetstatus: open -> closed
resolution: out of date
messages: + msg69100
nosy: + amaury.forgeotdarc
2008-07-02 14:46:22fgoujeonsetmessages: + msg69098
2008-07-02 14:42:42fgoujeoncreate