Dear sage-devel, I have a question about the usage of Cython . I would like to wrap a C++ library whose definition looks like
================================================= namespace bliss { class AbstractGraph; } class AbstractGraph { friend class Partition; ............. public: AbstractGraph(); virtual ~AbstractGraph(); class Graph : public AbstractGraph { public: Graph(const unsigned int N = 0); ~Graph(); } ================================================= Now as far as I understand Cython I *think* the following snippet should allow one to construct a Graph object ================================================= cdef extern from "path to graph.hh" namespace "bliss": cdef cppclass AbstractGraph: pass cdef cppclass Graph(AbstractGraph): Graph(const unsigned int) def foo(): cdef Graph *g = new Graph(10) ================================================= Unfortunately I get a myriad of compile errors : ================================================= build/cythonized/sage/graphs/bliss.cpp: In function 'PyObject* __pyx_pf_4sage_6graphs_5bliss_foo(PyObject*)': build/cythonized/sage/graphs/bliss.cpp:254:28: error: expected primary-expression before '__attribute__' # define CYTHON_UNUSED __attribute__ ((__unused__)) ^ build/cythonized/sage/graphs/bliss.cpp:578:3: note: in expansion of macro 'CYTHON_UNUSED' CYTHON_UNUSED Graph *__pyx_v_g; ^ build/cythonized/sage/graphs/bliss.cpp:581:3: error: 'Graph' was not declared in this scope Graph *__pyx_t_1; ^ ================================================= The full compilation log is attached. Can someone help me figure out my mistake in the above snippet? What would be the correct way of defining the Graph class as to be able to allocate it and later on use its methods? Best, Jernej -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
c.log
Description: Binary data