I am interested in getting started with CFFI, so I was looking at the tutorial. This part ran fine:
>>> from cffi import FFI >>> ffi = FFI() >>> ffi.cdef(""" ... int printf(const char *format, ...); // copy-pasted from the man page ... """)
However, as soon as I ran
C = ffi.dlopen(None), I got
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python36\lib\site-packages\cffi\api.py", line 140, in dlopen lib, function_cache = _make_ffi_library(self, name, flags) File "C:\Python36\lib\site-packages\cffi\api.py", line 786, in _make_ffi_library backendlib = _load_backend_lib(backend, libname, flags) File "C:\Python36\lib\site-packages\cffi\api.py", line 781, in _load_backend_lib raise OSError(msg) OSError: ctypes.util.find_library() did not manage to locate a library called 'c'
The correct thing to do on Windows is to
ffi.dlopen('msvcrt.dll'), which is the c runtime on Windows. (though I believe cffi should probably handle this itself)