Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c++2py with -p (property method) does not wrap return types #10

Open
HugoStrand opened this issue Feb 23, 2018 · 1 comment
Open

c++2py with -p (property method) does not wrap return types #10

HugoStrand opened this issue Feb 23, 2018 · 1 comment

Comments

@HugoStrand
Copy link
Member

Dear Olivier,

I am trying to finish the h5 serialization of the cthyb solver and I think I am hitting a bug in c++2py. When wrapping a class using the -p flag c++2py does not automatically wrap the return types of the methods.

Here is a minimal example:

struct return_struct_t {
  int foo = -1;
};
class class_with_method : return_struct_t{
public:
  class_with_method(int number) {
    foo = number;
  }
  return_struct_t get_data() { return *this; }
};

when wrapping this with c++2py wrap_return.hpp -p --only="class_with_method" one gets

Welcome to C++2py
Parsing the C++ file (may take a few seconds) ...
... done. 

Analysing dependencies
Wrapping classes:
    class_with_method
Generating wrap_return_desc.py
   Class class_with_method : transforming to property : 
        get_data 

i.e. the return_struct_t is not wrapped and this causes a compiler error when trying to compile the wrapper.

Best, H

@HugoStrand HugoStrand changed the title c++2py wiht -p (property method) does not wrap return types c++2py with -p (property method) does not wrap return types Feb 23, 2018
@HugoStrand
Copy link
Member Author

This problem also arise in cthyb where the wrapping still is not automatic since the types given as arguments to methods of the solver_core class are not in the list of detected dependencies. Hence, cpp2py does not add the required modules

import pytriqs.statistics.histograms
import pytriqs.atom_diag

nor the required include

#include <triqs/cpp2py_converters/arrays.hpp>

what is special with these modules is that the solver_core dependency on them is only through class method arguments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant