I am attempting to access the struct
template <int dim> struct Data {    double X[dim];   double Val[dim]; };    in cython. I was guessing the correct syntax should be something like:
cdef extern from "Lib.h" namespace "LIB":     cdef struct Data[int dim]:       double X[dim];       double Val[dim];   However, I am getting an syntax error. What is the correct syntax (if it is even possible)?
Replace struct keyword to cppclass keyword. This should help.
  cdef extern from "Lib.h" namespace "LIB":       cdef cppclass Data[int dim]:         double X[dim];         double Val[dim];   Also check out this thread: C++ Struct inheritance in 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