I am not sure about what you are asking for, but as far as I understood, I would say: Just expose what you need (here the State
type).
In your .pyx
or your .pxd
:
(Assuming the code in your question is part of a file named my_eigen.h
)
# Expose State
cdef extern from "some_path/my_eigen.h" namespace "xyz" :
cdef cppclass States:
# Expose only what you need here
pass
Once you have done the wrapping above, you are free to use State
where ever you need it in Cython code.
# Use State as is in your custom wrapped class
cdef extern from "my_class_header.h" namespace "my_ns" :
cdef cppclass MyClassUsingStates:
double getElement(States s, int row, int col)
...
Example:
Here my need was: having a python handler for std::ofstream
and no need to expose any of its methods (so I exposed none but it would have been possible...)
cdef extern from "<fstream>" namespace "std" :
cdef cppclass ofstream:
pass
cdef class Py_ofstream:
cdef ofstream *thisptr
def __cinit__(self):
self.thisptr = new ofstream()
def __dealloc__(self):
if self.thisptr:
del self.thisptr
Note : here I used it directly as a single block in my .pyx
(no additional .pyd
).
Tell me if misunderstood the question...