Including enumerations from C ++ header file in cython

What is the difference between these two snippets of cython code?

cdef extern from "some_header.h": enum _some_enum: ... ctypedef _some_enum some_enum 

and

 cdef extern enum _some_enum: ... ctypedef _some_enum some_enum 

Since you need to override enum in the .pyd file, does it matter if you say something about the header file? Can I include it from the header file instead of redialing it?

+4
source share
1 answer

There should be no problem for Cython to generate enumeration declarations. However, you usually want to use a headline to make sure that the declarations are consistent. Cython will have an #include header instead of including its own declarations. However, it doesn’t actually use heading declarations to generate code. You still have to write compatible ads. You can find more information in the user guide: Interaction with external C code: links to C header files .

+2
source

All Articles