[pypy-svn] r54787 - pypy/dist/pypy/rpython/lltypesystem

afa at codespeak.net afa at codespeak.net
Fri May 16 12:12:38 CEST 2008


Author: afa
Date: Fri May 16 12:12:37 2008
New Revision: 54787

Modified:
   pypy/dist/pypy/rpython/lltypesystem/rffi.py
Log:
on win32, don't declare external variables, and rely on the #includes 
to get the proper declaration.

Needed for _environ: when compiling a .exe (not a dll), _environ
is actually a macro...

IMO other platforms should do the same, but I cannot test them.


Modified: pypy/dist/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rffi.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rffi.py	Fri May 16 12:12:37 2008
@@ -13,7 +13,7 @@
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.translator.backendopt.canraise import RaiseAnalyzer
 from pypy.rpython.annlowlevel import llhelper
-import os
+import os, sys
 
 class UnhandledRPythonException(Exception):
     pass
@@ -399,7 +399,8 @@
     c_setter = "void %(setter_name)s (%(c_type)s v) { %(name)s = v; }" % locals()
 
     lines = ["#include <%s>" % i for i in eci.includes]
-    lines.append('extern %s %s;' % (c_type, name))
+    if sys.platform != 'win32':
+        lines.append('extern %s %s;' % (c_type, name))
     lines.append(c_getter)
     lines.append(c_setter)
     sources = ('\n'.join(lines),)



More information about the Pypy-commit mailing list