Skip to content

Commit 1a28498

Browse files
Roumen Petrovmingwandroid
authored andcommitted
MINGW: setup msvcrt and _winapi modules
1 parent f5c6377 commit 1a28498

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Modules/_winapi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939

4040
#define WINDOWS_LEAN_AND_MEAN
4141
#include "windows.h"
42+
#if defined(Py_DEBUG)
4243
#include <crtdbg.h>
44+
#endif
4345

4446
#if defined(MS_WIN32) && !defined(MS_WIN64)
4547
#define HANDLE_TO_PYNUM(handle) \

PC/msvcrtmodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
#include <io.h>
2222
#include <conio.h>
2323
#include <sys/locking.h>
24+
#ifdef _DEBUG
2425
#include <crtdbg.h>
26+
#endif
2527
#include <windows.h>
2628

2729
#ifdef _MSC_VER

setup.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,16 @@ def detect_modules(self):
887887
min_db_ver = (3, 3)
888888
db_setup_debug = False # verbose debug prints from this script?
889889

890+
# Modules with some Windows dependencies:
891+
if host_platform.startswith(('mingw', 'win')):
892+
srcdir = sysconfig.get_config_var('srcdir')
893+
pc_srcdir = os.path.abspath(os.path.join(srcdir, 'PC'))
894+
895+
exts.append( Extension('msvcrt', [os.path.join(pc_srcdir, p)
896+
for p in ['msvcrtmodule.c']]) )
897+
898+
exts.append( Extension('_winapi', ['_winapi.c']) )
899+
890900
def allow_db_ver(db_ver):
891901
"""Returns a boolean if the given BerkeleyDB version is acceptable.
892902

0 commit comments

Comments
 (0)