Compiling Python 2.2 in Microsoft VC7 (.net)

Mark Hammond mhammond at skippinet.com.au
Mon Feb 11 21:12:32 EST 2002


Joe Shochet wrote:
> I'm trying to get Python 2.2 to compile in VC7 (part of Visual Studio
> .net), but I'm running into all sorts of troubles. Before digging into
> the problems, has anybody else already done this?
> 
> The main problems seem be related to missing files (largeint.h,
> traceback.c were the first two I saw). Many more followed these
> errors.
> 

I can reproduce this, and am working towards a checkin that fixes it. 
Please try again in a day or so (and feel free to ping me if you still 
have problems.

FWIW, once I get it reviewed I intend checking in the patch below.  All 
seems to work after that.

Mark.

--- timemodule.c	16 Jan 2002 11:04:06 -0000	2.120
+++ timemodule.c	12 Feb 2002 02:04:04 -0000
@@ -46,17 +46,24 @@
  #define altzone _altzone
  #endif /* MS_WIN16 */
  #endif /* MS_WINDOWS */
  #endif /* !__WATCOMC__ || __QNX__ */

  #if defined(MS_WIN32) && !defined(MS_WIN64) && !defined(__BORLANDC__)
  /* Win32 has better clock replacement
     XXX Win64 does not yet, but might when the platform matures. */
+/* NOTE: VC6 used <largeint.h> for these macros.
+   They seem to have vanished with VC7 :( */
+#if _MSC_VER >= 1300 /* MS dropped the largeint.h helpers in VC7 :( */
+# 
define LargeIntegerEqualToZero(X) ( !((X).LowPart | (X).HighPart))
+#else
  #include <largeint.h>
+#endif
+
  #undef HAVE_CLOCK /* We have our own version down below */
  #endif /* MS_WIN32 && !MS_WIN64 */

  #if defined(PYCC_VACPP)
  #include <sys/time.h>
  #endif

  #ifdef __BEOS__
@@ -161,18 +168,24 @@
  		    LargeIntegerEqualToZero(divisor)) {
  	 
		/* Unlikely to happen -
  	 
		   this works on all intel machines at least!
  	 
		   Revert to clock() */
  	 
	return PyFloat_FromDouble(clock());
  		}
  	}
  	QueryPerformanceCounter(&now);
- 
diff = LargeIntegerSubtract(now, ctrStart);
- 
diff = LargeIntegerDivide(diff, divisor, &rem);
+#if _MSC_VER >= 1300 /* MS dropped the largeint.h helpers in VC7 :( */
+ 
diff.QuadPart = now.QuadPart - ctrStart.QuadPart;
+ 
rem.QuadPart = diff.QuadPart % divisor.QuadPart;
+ 
diff.QuadPart /= divisor.QuadPart;
+#else
+ 	diff = LargeIntegerSubtract(now, ctrStart);
+ 	diff = LargeIntegerDivide(diff, divisor, &rem);
+#endif
  	/* XXX - we assume both divide results fit in 32 bits.  This is
  	   true on Intels.  First person who can afford a machine that
  	   doesnt deserves to fix it :-)
  	*/
  	return PyFloat_FromDouble((double)diff.LowPart +
  		              ((double)rem.LowPart / (double)divisor.LowPart));
  }




and:
Index: _hotshot.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v
retrieving revision 1.13
diff -u -8 -r1.13 _hotshot.c
--- _hotshot.c	8 Feb 2002 21:27:50 -0000	1.13
+++ _hotshot.c	12 Feb 2002 02:11:42 -0000
@@ -9,17 +9,16 @@
  #include "structmember.h"

  /*
   * Which timer to use should be made more configurable, but that 
should not
   * be difficult.  This will do for now.
   */
  #ifdef MS_WIN32
  #include <windows.h>
-#include <largeint.h>
  #include <direct.h>    /* for getcwd() */
  typedef __int64 hs_time;
  #define GETTIMEOFDAY(P_HS_TIME) \
  	{ LARGE_INTEGER _temp; \
  	  QueryPerformanceCounter(&_temp); \
  	  *(P_HS_TIME) = _temp.QuadPart; }
  	






More information about the Python-list mailing list