Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c66ae96

Browse files
committed
Trent Mick:
Changes to PC\config.[hc] for Win64. MSVC defines _WINxx to differentiate the various windows platforms. Python's MS_WINxx are keyed off of these. Note that _WIN32 (and hence MS_WIN32 in Python) are defined on Win32 *and* on Win64. This is for compatibility reasons. The idea is that the common case is that code specific to Win32 will also work on Win64 rather than being specific to Win32 (i.e. there is more the same than different in WIn32 and Win64). The following modules are specifically excluded in the Win64 build: audioop, binascii, imageop, rgbimg. They are advertised as heavily 32-bit dependent. [They should probably be fixed! --GvR] The patch to config.h looks big but it really is not. These are the effective changes: - MS_WINxx are keyed off _WINxx - SIZEOF_VOID_P is set to 8 for Win64 - COMPILER string is changed appropriately for Win64
1 parent c682140 commit c66ae96

1 file changed

Lines changed: 57 additions & 23 deletions

File tree

PC/config.h

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ WINDOWS DEFINES:
1111
The code specific to Windows should be wrapped around one of
1212
the following #defines
1313
14-
MS_WIN32 - Code specific to the MS Win32 API
14+
MS_WIN64 - Code specific to the MS Win64 API
15+
MS_WIN32 - Code specific to the MS Win32 (and Win64) API
1516
MS_WIN16 - Code specific to the old 16 bit Windows API.
1617
MS_WINDOWS - Code specific to Windows, but all versions.
1718
MS_COREDLL - Code if the Python core is built as a DLL.
@@ -42,13 +43,54 @@ compiler specific". Therefore, these should be very rare.
4243
#define EXEC_PREFIX ""
4344

4445
/* Microsoft C defines _MSC_VER */
46+
#ifdef _MSC_VER
4547

46-
#if defined(_MSC_VER) && _MSC_VER > 850
47-
/* Start of defines for MS_WIN32 using VC++ 2.0 and up */
48+
/* MSVC defines _WINxx to differentiate the windows platform types
49+
50+
Note that for compatibility reasons _WIN32 is defined on Win32
51+
*and* on Win64. For the same reasons, in Python, MS_WIN32 is
52+
defined on Win32 *and* Win64. Win32 only code must therefore be
53+
guarded as follows:
54+
#if defined(MS_WIN32) && !defined(MS_WIN64)
55+
*/
56+
#ifdef _WIN64
57+
#define MS_WIN64
58+
#endif
59+
#ifdef _WIN32
4860
#define NT /* NT is obsolete - please use MS_WIN32 instead */
4961
#define MS_WIN32
62+
#endif
63+
#ifdef _WIN16
64+
#define MS_WIN16
65+
#endif
5066
#define MS_WINDOWS
5167

68+
/* set the COMPILER */
69+
#ifdef MS_WIN64
70+
#ifdef _M_IX86
71+
#define COMPILER "[MSC 64 bit (Intel)]"
72+
#elif defined(_M_ALPHA)
73+
#define COMPILER "[MSC 64 bit (Alpha)]"
74+
#else
75+
#define COMPILER "[MSC 64 bit (Unknown)]"
76+
#endif
77+
#endif /* MS_WIN64 */
78+
79+
#if defined(MS_WIN32) && !defined(MS_WIN64)
80+
#ifdef _M_IX86
81+
#define COMPILER "[MSC 32 bit (Intel)]"
82+
#elif defined(_M_ALPHA)
83+
#define COMPILER "[MSC 32 bit (Alpha)]"
84+
#else
85+
#define COMPILER "[MSC (Unknown)]"
86+
#endif
87+
#endif /* MS_WIN32 && !MS_WIN64 */
88+
89+
#endif /* _MSC_VER */
90+
91+
#if defined(_MSC_VER) && _MSC_VER > 850
92+
/* Start of defines for MS_WIN32 using VC++ 2.0 and up */
93+
5294
/* For NT the Python core is in a DLL by default. Test the
5395
standard macro MS_COREDLL to find out. If you have an exception
5496
you must define MS_NO_COREDLL (do not test this macro) */
@@ -59,13 +101,6 @@ you must define MS_NO_COREDLL (do not test this macro) */
59101
#endif /* !USE_DL_EXPORT */
60102
#endif /* !MS_NO_COREDLL */
61103

62-
#ifdef _M_IX86
63-
#define COMPILER "[MSC 32 bit (Intel)]"
64-
#elif defined(_M_ALPHA)
65-
#define COMPILER "[MSC 32 bit (Alpha)]"
66-
#else
67-
#define COMPILER "[MSC (Unknown)]"
68-
#endif
69104
#define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
70105
typedef int pid_t;
71106
#define WORD_BIT 32
@@ -92,11 +127,9 @@ typedef int pid_t;
92127
#define LONG_LONG __int64
93128
#endif /* _MSC_VER && > 850 */
94129

95-
#if defined(_MSC_VER) && _MSC_VER <= 850
130+
#if defined(_MSC_VER) && _MSC_VER <= 850 /* presume this implies Win16 */
96131
/* Start of defines for 16-bit Windows using VC++ 1.5 */
97132
#define COMPILER "[MSC 16-bit]"
98-
#define MS_WIN16
99-
#define MS_WINDOWS
100133
#define PYTHONPATH ".;.\\lib;.\\lib\\plat-win;.\\lib\\dos-8x3"
101134
#define IMPORT_8x3_NAMES
102135
typedef int pid_t;
@@ -200,15 +233,22 @@ typedef int pid_t;
200233

201234
/* End of compilers - finish up */
202235

203-
#ifdef MS_WIN32
236+
#if defined(MS_WIN64)
237+
#define PLATFORM "win64"
238+
#define SIZEOF_VOID_P 8
239+
#elif defined(MS_WIN32)
204240
#define PLATFORM "win32"
241+
#ifdef _M_ALPHA
242+
#define SIZEOF_VOID_P 8
205243
#else
206-
#ifdef MS_WIN16
244+
#define SIZEOF_VOID_P 4
245+
#endif
246+
#elif defined(MS_WIN16)
207247
#define PLATFORM "win16"
208248
#else
209249
#define PLATFORM "dos"
210-
#endif /* !MS_WIN16 */
211-
#endif /* !MS_WIN32 */
250+
#endif
251+
212252

213253
#ifdef MS_WIN32
214254

@@ -229,12 +269,6 @@ typedef int pid_t;
229269
#define SIZEOF_LONG 4
230270
#define SIZEOF_LONG_LONG 8
231271

232-
#ifdef _M_ALPHA
233-
#define SIZEOF_VOID_P 8
234-
#else
235-
#define SIZEOF_VOID_P 4
236-
#endif
237-
238272
/* Smaller stack size limit. (9500 would work too, but we're conservative.) */
239273

240274
#ifndef MAX_RECURSION_DEPTH

0 commit comments

Comments
 (0)