Skip to content

Commit 901a082

Browse files
Alexpuxlazka
authored andcommitted
pyport.h: Add support for MINGW
Co-authored-by: Алексей <[email protected]>
1 parent 203d18e commit 901a082

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Include/pyport.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -524,12 +524,12 @@ extern char * _getpty(int *, int, mode_t, int);
524524
*/
525525

526526
/*
527-
All windows ports, except cygwin, are handled in PC/pyconfig.h.
527+
Only MSVC windows ports is handled in PC/pyconfig.h.
528528
529-
Cygwin is the only other autoconf platform requiring special
529+
Cygwin and Mingw is the only other autoconf platform requiring special
530530
linkage handling and it uses __declspec().
531531
*/
532-
#if defined(__CYGWIN__)
532+
#if defined(__CYGWIN__) || defined(__MINGW32__)
533533
# define HAVE_DECLSPEC_DLL
534534
#endif
535535

@@ -542,21 +542,23 @@ extern char * _getpty(int *, int, mode_t, int);
542542
# define PyAPI_FUNC(RTYPE) Py_EXPORTED_SYMBOL RTYPE
543543
# define PyAPI_DATA(RTYPE) extern Py_EXPORTED_SYMBOL RTYPE
544544
/* module init functions inside the core need no external linkage */
545-
/* except for Cygwin to handle embedding */
546-
# if defined(__CYGWIN__)
545+
/* except for Cygwin/Mingw to handle embedding */
546+
# if defined(__CYGWIN__) || defined(__MINGW32__)
547547
# define PyMODINIT_FUNC Py_EXPORTED_SYMBOL PyObject*
548-
# else /* __CYGWIN__ */
548+
# else /* __CYGWIN__ || __MINGW32__*/
549549
# define PyMODINIT_FUNC PyObject*
550-
# endif /* __CYGWIN__ */
550+
# endif /* __CYGWIN__ || __MINGW32__*/
551551
# else /* Py_BUILD_CORE */
552552
/* Building an extension module, or an embedded situation */
553553
/* public Python functions and data are imported */
554554
/* Under Cygwin, auto-import functions to prevent compilation */
555555
/* failures similar to those described at the bottom of 4.1: */
556556
/* http://docs.python.org/extending/windows.html#a-cookbook-approach */
557-
# if !defined(__CYGWIN__)
557+
# if defined(__CYGWIN__) || defined(__MINGW32__)
558+
# define PyAPI_FUNC(RTYPE) RTYPE
559+
# else
558560
# define PyAPI_FUNC(RTYPE) Py_IMPORTED_SYMBOL RTYPE
559-
# endif /* !__CYGWIN__ */
561+
# endif /* __CYGWIN__ || __MINGW32__*/
560562
# define PyAPI_DATA(RTYPE) extern Py_IMPORTED_SYMBOL RTYPE
561563
/* module init functions outside the core must be exported */
562564
# if defined(__cplusplus)

0 commit comments

Comments
 (0)