[Cython] defining module constants

Stefan Behnel stefan_ml at behnel.de
Tue May 13 18:41:22 CEST 2008


Anatoly A. Kazantsev wrote:
> In foo.h somebody wrote:
>
> #define BAR 1
>
> than I want to define module constant with same name and value:
>
> cdef export from "foo.h":
>   typedef enum:
>     _BAR "BAR"

You can just use

  cdef extern from "foo.h":
    cdef int BAR

Stefan



More information about the Cython-dev mailing list