[pypy-commit] pypy default: Fix: even if there are libraries listed, fall back to look in

arigo noreply at buildbot.pypy.org
Sun Feb 5 14:58:28 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r52110:ba6857447ed7
Date: 2012-02-05 14:58 +0100
http://bitbucket.org/pypy/pypy/changeset/ba6857447ed7/

Log:	Fix: even if there are libraries listed, fall back to look in the
	standard C library if the symbol is not found elsewhere.

diff --git a/pypy/rpython/lltypesystem/ll2ctypes.py b/pypy/rpython/lltypesystem/ll2ctypes.py
--- a/pypy/rpython/lltypesystem/ll2ctypes.py
+++ b/pypy/rpython/lltypesystem/ll2ctypes.py
@@ -1036,13 +1036,8 @@
     libraries = eci.testonly_libraries + eci.libraries + eci.frameworks
 
     FUNCTYPE = lltype.typeOf(funcptr).TO
-    if not libraries:
-        cfunc = get_on_lib(standard_c_lib, funcname)
-        # XXX magic: on Windows try to load the function from 'kernel32' too
-        if cfunc is None and hasattr(ctypes, 'windll'):
-            cfunc = get_on_lib(ctypes.windll.kernel32, funcname)
-    else:
-        cfunc = None
+    cfunc = None
+    if libraries:
         not_found = []
         for libname in libraries:
             libpath = None
@@ -1075,6 +1070,12 @@
                 not_found.append(libname)
 
     if cfunc is None:
+        cfunc = get_on_lib(standard_c_lib, funcname)
+        # XXX magic: on Windows try to load the function from 'kernel32' too
+        if cfunc is None and hasattr(ctypes, 'windll'):
+            cfunc = get_on_lib(ctypes.windll.kernel32, funcname)
+
+    if cfunc is None:
         # function name not found in any of the libraries
         if not libraries:
             place = 'the standard C library (missing libraries=...?)'


More information about the pypy-commit mailing list