I'm wrapping a library that makes massive use of enumerations and therefore contains many constant identifiers. Is there a way to make them available to Cython (declare them as extern
) and at the same time make them available to Python?
I search for something like this
cdef extern from *:
public enum:
spam
foo
ham
which should replace
cdef extern from *:
enum:
cspam "spam"
cfoo "foo"
cham "ham"
spam = cspam
foo = cfoo
ham = cham
Note: I know about the option to move the extern-declarations to a .pxd file to avoid naming-collision.
Thanks, Niklas
I have used ctypesgen.py
with some success for exporting types and enumerations. This would likely be adequate for both python and cython.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With