I want to define a C array in my Cython code, which I understand does not work with dynamic variables, e.g. this does not work:
cdef int length = 30
cdef np.double_t[length] carr
I read here that it is possible to define static variables at compilation time for this purpose but I get a compilation error when I try to cast the variable like this:
DEF int length = 30
...
The Error reads:
Expected '=', found 'length'
And I likewise get an understandable error when I try to go without casting:
Array dimension not integer
Someone else has asked a similar question here but did not receive any answers.
Is it possible to define a variable at compilation time to use later on to set the size of a C array?