[pypy-svn] pypy default: Fix cpyext tests on Windows

amauryfa commits-noreply at bitbucket.org
Sat Feb 26 23:28:43 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r42310:9ec0c12251ab
Date: 2011-02-26 23:24 +0100
http://bitbucket.org/pypy/pypy/changeset/9ec0c12251ab/

Log:	Fix cpyext tests on Windows

diff --git a/pypy/translator/platform/windows.py b/pypy/translator/platform/windows.py
--- a/pypy/translator/platform/windows.py
+++ b/pypy/translator/platform/windows.py
@@ -120,7 +120,12 @@
         return ['/I%s' % (idir,) for idir in include_dirs]
 
     def _libs(self, libraries):
-        return ['%s.lib' % (lib,) for lib in libraries]
+        libs = []
+        for lib in libraries:
+            if lib.endswith('.dll'):
+                lib = lib[:-4]
+            libs.append('%s.lib' % (lib,))
+        return libs
 
     def _libdirs(self, library_dirs):
         return ['/LIBPATH:%s' % (ldir,) for ldir in library_dirs]

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -832,6 +832,9 @@
         if sys.platform == "win32":
             # '%s' undefined; assuming extern returning int
             compile_extra.append("/we4013")
+            # Sometimes the library is wrapped into another DLL, ensure that
+            # the correct bootstrap code is installed
+            kwds["link_extra"] = ["msvcrt.lib"]
         elif sys.platform == 'linux2':
             compile_extra.append("-Werror=implicit-function-declaration")
         export_symbols_eci.append('pypyAPI')


More information about the Pypy-commit mailing list