Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Unified Diff: PC/msvcrtmodule.c

Issue 3871: cross and native build of python for mingw32 with distutils
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « PC/getpathp.c ('k') | PC/pyconfig.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/PC/msvcrtmodule.c Thu Dec 27 23:52:36 2012 +0200
+++ b/PC/msvcrtmodule.c Thu Dec 27 17:35:12 2012 -0500
@@ -21,9 +21,39 @@
#include <io.h>
#include <conio.h>
#include <sys/locking.h>
+#ifdef _MSC_VER
+# define HAVE_CRTDBG_H
+#endif
+#ifdef HAVE_CRTDBG_H
#include <crtdbg.h>
+#endif
#include <windows.h>
+#if defined(__MINGW32__)
+#if __MSVCRT_VERSION__ >= 0x0700
+# define _WCONIO_DEFINED
+/* NOTE: Up to version ?.?? mingw don't define functions
+ * listed below. Also this require module to be linked with
+ * ms-vcrt at least verion 7.
+ * To build with different runtimes see:
+ * http://www.mingw.org/wiki/HOWTO_Use_the_GCC_specs_file
+ *
+ * Also note that NT5.1(XP), shiped with msvcrt version 7.0,
+ * contain all those functions, but library name is msvcrt.dll.
+ * So if you like module to run on w2k as is you must define
+ * appropriate __MSVCRT_VERSION__ .
+ * If you like those functions even on w2k you must link
+ * with appropriate runtime and to pack it in distributions.
+ * This is what MSVC build do - it is build and packed
+ * with version 9.0 of Microsoft C-runtime.
+ */
+_CRTIMP wint_t __cdecl __MINGW_NOTHROW _getwch (void);
+_CRTIMP wint_t __cdecl __MINGW_NOTHROW _getwche (void);
+_CRTIMP wint_t __cdecl __MINGW_NOTHROW _putwch (wchar_t);
+_CRTIMP wint_t __cdecl __MINGW_NOTHROW _ungetwch(wint_t);
+#endif /* __MSVCRT_VERSION__ >= 0x0700 */
+#endif
+
#ifdef _MSC_VER
#if _MSC_VER >= 1500 && _MSC_VER < 1600
#include <crtassem.h>
@@ -319,6 +349,7 @@
if (!PyArg_ParseTuple(args, "c:ungetch", &ch))
return NULL;
+ /* FIXME: why _ungetch is called instead _ungetwch */
if (_ungetch(ch) == EOF)
return PyErr_SetFromErrno(PyExc_IOError);
Py_INCREF(Py_None);
« no previous file with comments | « PC/getpathp.c ('k') | PC/pyconfig.h » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+