Alternative cppclass constructors not declared in cxx file, even when declared in pxd #1582

scopatz opened this Issue Jan 17, 2017 · 0 comments


None yet

1 participant

scopatz commented Jan 17, 2017

In cppclass, if an extra constructor beyond the null arity one is is declared in Cython, it won't actually be generated in the struct. Instead Cython, will just skip the declaration. This then causes a C++ compile time failure for any code trying to use this constructor since the declaration from the header and the delration from the implementation don't match.

For the time being I have circumvented this via a small post-process scrip available here:

Example below.

cdef cppclass Example:
    Example(int, double, char*)
    void method(int, double, char*)
    double data

Generated C++, not that Example(int, double, char*) is not present in the struct, even though the other members are.

struct __pyx_t_6cyclus_6agents_Example {
  virtual void method(int, double, char *);

  /* "cyclus/agents.pxd":16
 * from cyclus.cpp_cyclus cimport shared_ptr
 * cdef cppclass Example:             # <<<<<<<<<<<<<<
 *     Example()
 *     Example(int, double, char*)
  double data;
  virtual ~__pyx_t_6cyclus_6agents_Example() { }};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment