[Patches] PC\config.[hc] changes for Win64
Trent Mick
trentm@activestate.com
Fri, 5 May 2000 13:58:17 -0700
Discussion:
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.
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
Trent
--
Trent Mick
trentm@activestate.com
Legal:
I confirm that, to the best of my knowledge and belief, this
contribution is free of any claims of third parties under
copyright, patent or other rights or interests ("claims"). To
the extent that I have any such claims, I hereby grant to CNRI a
nonexclusive, irrevocable, royalty-free, worldwide license to
reproduce, distribute, perform and/or display publicly, prepare
derivative versions, and otherwise use this contribution as part
of the Python software and its related documentation, or any
derivative versions thereof, at no cost to CNRI or its licensed
users, and to authorize others to do so.
I acknowledge that CNRI may, at its sole discretion, decide
whether or not to incorporate this contribution in the Python
software and its related documentation. I further grant CNRI
permission to use my name and other identifying information
provided to CNRI by me for use in connection with the Python
software and its related documentation.
Patch:
*** /home/trentm/main/contrib/python/dist/src/PC/config.h Fri May 5 10:53:35 2000
--- ./PC/config.h Fri May 5 13:10:11 2000
***************
*** 11,17 ****
The code specific to Windows should be wrapped around one of
the following #defines
! MS_WIN32 - Code specific to the MS Win32 API
MS_WIN16 - Code specific to the old 16 bit Windows API.
MS_WINDOWS - Code specific to Windows, but all versions.
MS_COREDLL - Code if the Python core is built as a DLL.
--- 11,18 ----
The code specific to Windows should be wrapped around one of
the following #defines
! MS_WIN64 - Code specific to the MS Win64 API
! MS_WIN32 - Code specific to the MS Win32 (and Win64) API
MS_WIN16 - Code specific to the old 16 bit Windows API.
MS_WINDOWS - Code specific to Windows, but all versions.
MS_COREDLL - Code if the Python core is built as a DLL.
***************
*** 42,54 ****
#define EXEC_PREFIX ""
/* Microsoft C defines _MSC_VER */
! #if defined(_MSC_VER) && _MSC_VER > 850
! /* Start of defines for MS_WIN32 using VC++ 2.0 and up */
#define NT /* NT is obsolete - please use MS_WIN32 instead */
#define MS_WIN32
#define MS_WINDOWS
/* For NT the Python core is in a DLL by default. Test the
standard macro MS_COREDLL to find out. If you have an exception
you must define MS_NO_COREDLL (do not test this macro) */
--- 43,96 ----
#define EXEC_PREFIX ""
/* Microsoft C defines _MSC_VER */
+ #ifdef _MSC_VER
! /* MSVC defines _WINxx to differentiate the windows platform types
!
! Note that for compatibility reasons _WIN32 is defined on Win32
! *and* on Win64. For the same reasons, in Python, MS_WIN32 is
! defined on Win32 *and* Win64. Win32 only code must therefore be
! guarded as follows:
! #if defined(MS_WIN32) && !defined(MS_WIN64)
! */
! #ifdef _WIN64
! #define MS_WIN64
! #endif
! #ifdef _WIN32
#define NT /* NT is obsolete - please use MS_WIN32 instead */
#define MS_WIN32
+ #endif
+ #ifdef _WIN16
+ #define MS_WIN16
+ #endif
#define MS_WINDOWS
+ /* set the COMPILER */
+ #ifdef MS_WIN64
+ #ifdef _M_IX86
+ #define COMPILER "[MSC 64 bit (Intel)]"
+ #elif defined(_M_ALPHA)
+ #define COMPILER "[MSC 64 bit (Alpha)]"
+ #else
+ #define COMPILER "[MSC 64 bit (Unknown)]"
+ #endif
+ #endif /* MS_WIN64 */
+
+ #if defined(MS_WIN32) && !defined(MS_WIN64)
+ #ifdef _M_IX86
+ #define COMPILER "[MSC 32 bit (Intel)]"
+ #elif defined(_M_ALPHA)
+ #define COMPILER "[MSC 32 bit (Alpha)]"
+ #else
+ #define COMPILER "[MSC (Unknown)]"
+ #endif
+ #endif /* MS_WIN32 && !MS_WIN64 */
+
+ #endif /* _MSC_VER */
+
+ #if defined(_MSC_VER) && _MSC_VER > 850
+ /* Start of defines for MS_WIN32 using VC++ 2.0 and up */
+
/* For NT the Python core is in a DLL by default. Test the
standard macro MS_COREDLL to find out. If you have an exception
you must define MS_NO_COREDLL (do not test this macro) */
***************
*** 59,71 ****
#endif /* !USE_DL_EXPORT */
#endif /* !MS_NO_COREDLL */
- #ifdef _M_IX86
- #define COMPILER "[MSC 32 bit (Intel)]"
- #elif defined(_M_ALPHA)
- #define COMPILER "[MSC 32 bit (Alpha)]"
- #else
- #define COMPILER "[MSC (Unknown)]"
- #endif
#define PYTHONPATH ".\\DLLs;.\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
typedef int pid_t;
#define WORD_BIT 32
--- 101,106 ----
***************
*** 92,102 ****
#define LONG_LONG __int64
#endif /* _MSC_VER && > 850 */
! #if defined(_MSC_VER) && _MSC_VER <= 850
/* Start of defines for 16-bit Windows using VC++ 1.5 */
#define COMPILER "[MSC 16-bit]"
- #define MS_WIN16
- #define MS_WINDOWS
#define PYTHONPATH ".;.\\lib;.\\lib\\plat-win;.\\lib\\dos-8x3"
#define IMPORT_8x3_NAMES
typedef int pid_t;
--- 127,135 ----
#define LONG_LONG __int64
#endif /* _MSC_VER && > 850 */
! #if defined(_MSC_VER) && _MSC_VER <= 850 /* presume this implies Win16 */
/* Start of defines for 16-bit Windows using VC++ 1.5 */
#define COMPILER "[MSC 16-bit]"
#define PYTHONPATH ".;.\\lib;.\\lib\\plat-win;.\\lib\\dos-8x3"
#define IMPORT_8x3_NAMES
typedef int pid_t;
***************
*** 200,214 ****
/* End of compilers - finish up */
! #ifdef MS_WIN32
#define PLATFORM "win32"
#else
! #ifdef MS_WIN16
#define PLATFORM "win16"
#else
#define PLATFORM "dos"
! #endif /* !MS_WIN16 */
! #endif /* !MS_WIN32 */
#ifdef MS_WIN32
--- 233,254 ----
/* End of compilers - finish up */
! #if defined(MS_WIN64)
! #define PLATFORM "win64"
! #define SIZEOF_VOID_P 8
! #elif defined(MS_WIN32)
#define PLATFORM "win32"
+ #ifdef _M_ALPHA
+ #define SIZEOF_VOID_P 8
#else
! #define SIZEOF_VOID_P 4
! #endif
! #elif defined(MS_WIN16)
#define PLATFORM "win16"
#else
#define PLATFORM "dos"
! #endif
!
#ifdef MS_WIN32
***************
*** 229,240 ****
#define SIZEOF_LONG 4
#define SIZEOF_LONG_LONG 8
- #ifdef _M_ALPHA
- #define SIZEOF_VOID_P 8
- #else
- #define SIZEOF_VOID_P 4
- #endif
-
/* Smaller stack size limit. (9500 would work too, but we're conservative.) */
#ifndef MAX_RECURSION_DEPTH
--- 269,274 ----
*** /home/trentm/main/contrib/python/dist/src/PC/config.c Fri May 5 10:53:35 2000
--- ./PC/config.c Fri May 5 13:10:11 2000
***************
*** 37,54 ****
--- 37,60 ----
#include "Python.h"
extern void initarray();
+ #ifndef MS_WIN64
extern void initaudioop();
extern void initbinascii();
+ #endif
extern void initcmath();
extern void initerrno();
+ #ifndef MS_WIN64
extern void initimageop();
+ #endif
extern void initmath();
extern void initmd5();
extern void initnew();
extern void initnt();
extern void initoperator();
extern void initregex();
+ #ifndef MS_WIN64
extern void initrgbimg();
+ #endif
extern void initrotor();
extern void initsignal();
extern void initsha();
***************
*** 74,92 ****
--- 80,106 ----
{"array", initarray},
#ifdef MS_WINDOWS
+ #ifndef MS_WIN64
{"audioop", initaudioop},
#endif
+ #endif
+ #ifndef MS_WIN64
{"binascii", initbinascii},
+ #endif
{"cmath", initcmath},
{"errno", initerrno},
+ #ifndef MS_WIN64
{"imageop", initimageop},
+ #endif
{"math", initmath},
{"md5", initmd5},
{"new", initnew},
{"nt", initnt}, /* Use the NT os functions, not posix */
{"operator", initoperator},
{"regex", initregex},
+ #ifndef MS_WIN64
{"rgbimg", initrgbimg},
+ #endif
{"rotor", initrotor},
{"signal", initsignal},
{"sha", initsha},