I have a C header which defines a function in a macro. I need to call it from Cython. Is there a way to use the macro in Cython and have it fully expanded? I already have the arguments as C types.
I've tried using cdef like I would for a function, which is, I think, what the documentation says.
Do you mean something like this?
#define SUM(a,b) (a) + (b)
In this case, declare it as a function in a cdef extern from "lib.h"
block, and specify the type of arguments it takes and should return. Refer to the docs.
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