[Cython] Status

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Jan 31 08:36:05 EST 2020


On 1/02/20 12:25 am, John Skaller2 wrote:
> cdef extern from "Python.h":
>      ctypedef int int32_t
>      ctypedef int int64_t
>      ctypedef unsigned int uint32_t
>      ctypedef unsigned int uint64_t

These work because Cython doesn't need to know the exact
sizes of these types. All it needs to know is that they're
some kind of integer so that its type checks will pass.
The typedef names end up in the generated C code, and the
C compiler figures out their actual sizes.

> Obviously this is an incorrect translation of the original source.

Extern declarations in Cython are not meant to be exact
translations. They only need to tell Cython enough about
the thing being declared so that it can cope.

-- 
Greg


More information about the cython-devel mailing list