im using cython to import c enums from .h file to my python code (the goal is to have one place that will include the enums for both of my programs).
so i have my enums.h
file:
typedef enum Numbers{
ONE=1, TWO, THREE
} Numbers;
and i have my enums.pyx
cdef extern from "enums.h":
cpdef enum Numbers:
ONE,
TWO,
THREE
and this code works in the sense that it imports the enum to be accessible from the python code with the right values. i want to take it a step further and want to automatically identify the members of the c enums, so the pyx file would update automaticly, when i do:
cdef extern from "enums.h":
cpdef enum Numbers:
pass
i get a Numbers enum in the python but without members (so even if I do Numbers(1)
ill get an error).
is there a way to identify the c enum members automatically?