[Python-Dev] Ctypes and the stdlib (was Re: LZMA compression support in 3.3) (original) (raw)

Benjamin Peterson benjamin at python.org
Mon Aug 29 15:20:56 CEST 2011


2011/8/29 Glyph Lefkowitz <glyph at twistedmatrix.com>:

On Aug 28, 2011, at 7:27 PM, Guido van Rossum wrote: In general, an existing library cannot be called without access to its .h files -- there are probably struct and constant definitions, platform-specific #ifdefs and #defines, and other things in there that affect the linker-level calling conventions for the functions in the library. Unfortunately I don't know a lot about this, but I keep hearing about something called "rffi" that PyPy uses to call C from RPython: <http://readthedocs.org/docs/pypy/en/latest/rffi.html>.  This has some shortcomings currently, most notably the fact that it needs those .h files (and therefore a C compiler) at runtime

This is incorrect. rffi is actually quite like ctypes. The part you are referring to is probably rffi_platform [1], which invokes the compiler to determine constant values and struct offsets, or ctypes_configure, which does need runtime headers [2].

[1] https://bitbucket.org/pypy/pypy/src/92e36ab4eb5e/pypy/rpython/tool/rffi_platform.py

[2] https://bitbucket.org/pypy/pypy/src/92e36ab4eb5e/ctypes_configure/

-- Regards, Benjamin



More information about the Python-Dev mailing list