[pypy-commit] cffi default: Windows test fix, and documentation about ffi.dlopen()'s restriction
arigo
noreply at buildbot.pypy.org
Mon Jun 1 09:13:37 CEST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r2150:eb3b8aad6ecf
Date: 2015-06-01 09:14 +0200
http://bitbucket.org/cffi/cffi/changeset/eb3b8aad6ecf/
Log: Windows test fix, and documentation about ffi.dlopen()'s restriction
diff --git a/doc/source/cdef.rst b/doc/source/cdef.rst
--- a/doc/source/cdef.rst
+++ b/doc/source/cdef.rst
@@ -278,6 +278,16 @@
needed. (Alternatively, the out-of-line FFIs have a method
``ffi.dlclose(lib)``.)
+Note: the old version of ``ffi.dlopen()`` from the in-line ABI mode
+tries to use ``ctypes.util.find_library()`` if it cannot directly find
+the library. The newer out-of-line ``ffi.dlopen()`` no longer does it
+automatically; it simply passes the argument it receives to the
+underlying ``dlopen()`` or ``LoadLibrary()`` function. If needed, it
+is up to you to use ``ctypes.util.find_library()`` or any other way to
+look for the library's filename. This also means that
+``ffi.dlopen(None)`` no longer work on Windows; try instead
+``ffi.dlopen(ctypes.util.find_library('c'))``.
+
ffi.set_source(): preparing out-of-line modules
-----------------------------------------------
diff --git a/testing/cffi1/test_re_python.py b/testing/cffi1/test_re_python.py
--- a/testing/cffi1/test_re_python.py
+++ b/testing/cffi1/test_re_python.py
@@ -90,7 +90,11 @@
def test_dlopen_none():
import _cffi_backend
from re_python_pysrc import ffi
- lib = ffi.dlopen(None)
+ name = None
+ if sys.platform == 'win32':
+ import ctypes.util
+ name = ctypes.util.find_msvcrt()
+ lib = ffi.dlopen(name)
assert lib.strlen(b"hello") == 5
def test_dlclose():
More information about the pypy-commit
mailing list