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

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Aug 30 07:55:20 CEST 2011


Guido van Rossum wrote:

> On Mon, Aug 29, 2011 at 2:17 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

>>All you
>>need to do when writing the .pyx file is follow the same
>>API that you would if you were writing C code to use the
>>library.
>
> Interesting. Then how does Pyrex/Cython typecheck your code at compile time?

You might be reading more into that statement than I meant.
You have to supply Pyrex/Cython versions of the C declarations,
either hand-written or generated by a tool. But you write them
based on the advertised C API -- you don't have to manually
expand macros, work out the low-level layout of structs, or
anything like that (as you often have to do when using ctypes).

-- 
Greg



More information about the Python-Dev mailing list