Hello, when generating binding code using Py++ i got following warnings: WARNING: hapl::Fenotype const * hapl::Fenotypes::find_equal(hapl::Fenotype const & pattern) const [member function] > compilation error W1050: The function returns "hapl::Fenotype const *" type. You have to specify a call policies.Be sure to take a look on Py++ defined > call policies: http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies
WARNING: hapl::Fenotype * hapl::Fenotypes::find_equal(hapl::Fenotype const & pattern) [member function] > compilation error W1050: The function returns "hapl::Fenotype *" type. You have to specify a call policies.Be sure to take a look on Py++ defined call > policies: http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies WARNING: hapl::Haplotype const * hapl::Haplotypes::find_equal(hapl::Haplotype const & pattern) const [member function] > compilation error W1050: The function returns "hapl::Haplotype const *" type. You have to specify a call policies.Be sure to take a look on Py++ defined > call policies: http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies WARNING: hapl::Haplotype const * hapl::Genotype::getUp() const [member function] > compilation error W1050: The function returns "hapl::Haplotype const *" type. You have to specify a call policies.Be sure to take a look on Py++ defined > call policies: http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies WARNING: hapl::Haplotype const * hapl::Genotype::getDown() const [member function] > compilation error W1050: The function returns "hapl::Haplotype const *" type. You have to specify a call policies.Be sure to take a look on Py++ defined > call policies: http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies WARNING: hapl::Fenotype const * hapl::Genotype::getFenotype() const [member function] > compilation error W1050: The function returns "hapl::Fenotype const *" type. You have to specify a call policies.Be sure to take a look on Py++ defined > call policies: http://language-binding.net/pyplusplus/documentation/functions/call_policies.html#py-defined-call-policies so I found all function declarations returning 'hapl::Fenotype const *' and ' hapl::Haplotype const *' in my header files and assigned call policies: mb.member_function( 'getLocus' ).call_policies = module_builder.call_policies.return_internal_reference() mb.member_functions( 'findVariant' ).call_policies = module_builder.call_policies.return_internal_reference() mb.member_functions( 'find_equal' ).call_policies = module_builder.call_policies.return_internal_reference() mb.member_function( 'getUp' ).call_policies = module_builder.call_policies.return_internal_reference() mb.member_function( 'getDown' ).call_policies = module_builder.call_policies.return_internal_reference() mb.member_function( 'getFenotype' ).call_policies = module_builder.call_policies.return_internal_reference() now all warnings disappeared. But when compiling output file i got some errors: /usr/include/boost/python/detail/invoke.hpp: In function 'PyObject* boost::python::detail::invoke(boost::python::detail::invoke_tag_<false, false>, const RC&, F&, AC0&) [with RC = boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const hapl::Fenotype* (*)(std::pair<const hapl::Fenotype* const, double>&), Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const hapl::Fenotype*, std::pair<const hapl::Fenotype* const, double>&>]::result_converter, F = const hapl::Fenotype* (*)(std::pair<const hapl::Fenotype* const, double>&), AC0 = boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const hapl::Fenotype* (*)(std::pair<const hapl::Fenotype* const, double>&), Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const hapl::Fenotype*, std::pair<const hapl::Fenotype* const, double>&>]::c_t0]': /usr/include/boost/python/detail/caller.hpp:199: instantiated from 'PyObject* boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const hapl::Fenotype* (*)(std::pair<const hapl::Fenotype* const, double>&), Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const hapl::Fenotype*, std::pair<const hapl::Fenotype* const, double>&>]' /usr/include/boost/python/object/py_function.hpp:38: instantiated from 'PyObject* boost::python::objects::caller_py_function_impl<Caller>::operator()(PyObject*, PyObject*) [with Caller = boost::python::detail::caller<const hapl::Fenotype* (*)(std::pair<const hapl::Fenotype* const, double>&), boost::python::default_call_policies, boost::mpl::vector2<const hapl::Fenotype*, std::pair<const hapl::Fenotype* const, double>&> >]' bindings.cpp:780: instantiated from here /usr/include/boost/python/detail/invoke.hpp:75: error: no match for call to '(const boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<const hapl::Fenotype*>) (const hapl::Fenotype*)' /usr/include/boost/python/detail/invoke.hpp: In function 'PyObject* boost::python::detail::invoke(boost::python::detail::invoke_tag_<false, false>, const RC&, F&, AC0&) [with RC = boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const hapl::Genotype* (*)(std::pair<const hapl::Genotype* const, double>&), Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const hapl::Genotype*, std::pair<const hapl::Genotype* const, double>&>]::result_converter, F = const hapl::Genotype* (*)(std::pair<const hapl::Genotype* const, double>&), AC0 = boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const hapl::Genotype* (*)(std::pair<const hapl::Genotype* const, double>&), Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const hapl::Genotype*, std::pair<const hapl::Genotype* const, double>&>]::c_t0]': /usr/include/boost/python/detail/caller.hpp:199: instantiated from 'PyObject* boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const hapl::Genotype* (*)(std::pair<const hapl::Genotype* const, double>&), Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const hapl::Genotype*, std::pair<const hapl::Genotype* const, double>&>]' /usr/include/boost/python/object/py_function.hpp:38: instantiated from 'PyObject* boost::python::objects::caller_py_function_impl<Caller>::operator()(PyObject*, PyObject*) [with Caller = boost::python::detail::caller<const hapl::Genotype* (*)(std::pair<const hapl::Genotype* const, double>&), boost::python::default_call_policies, boost::mpl::vector2<const hapl::Genotype*, std::pair<const hapl::Genotype* const, double>&> >]' bindings.cpp:780: instantiated from here /usr/include/boost/python/detail/invoke.hpp:75: error: no match for call to '(const boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<const hapl::Genotype*>) (const hapl::Genotype*)' /usr/include/boost/python/detail/invoke.hpp: In function 'PyObject* boost::python::detail::invoke(boost::python::detail::invoke_tag_<false, false>, const RC&, F&, AC0&) [with RC = boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const hapl::Haplotype* (*)(std::pair<const hapl::Haplotype* const, double>&), Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const hapl::Haplotype*, std::pair<const hapl::Haplotype* const, double>&>]::result_converter, F = const hapl::Haplotype* (*)(std::pair<const hapl::Haplotype* const, double>&), AC0 = boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const hapl::Haplotype* (*)(std::pair<const hapl::Haplotype* const, double>&), Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const hapl::Haplotype*, std::pair<const hapl::Haplotype* const, double>&>]::c_t0]': /usr/include/boost/python/detail/caller.hpp:199: instantiated from 'PyObject* boost::python::detail::caller_arity<1u>::impl<F, Policies, Sig>::operator()(PyObject*, PyObject*) [with F = const hapl::Haplotype* (*)(std::pair<const hapl::Haplotype* const, double>&), Policies = boost::python::default_call_policies, Sig = boost::mpl::vector2<const hapl::Haplotype*, std::pair<const hapl::Haplotype* const, double>&>]' /usr/include/boost/python/object/py_function.hpp:38: instantiated from 'PyObject* boost::python::objects::caller_py_function_impl<Caller>::operator()(PyObject*, PyObject*) [with Caller = boost::python::detail::caller<const hapl::Haplotype* (*)(std::pair<const hapl::Haplotype* const, double>&), boost::python::default_call_policies, boost::mpl::vector2<const hapl::Haplotype*, std::pair<const hapl::Haplotype* const, double>&> >]' bindings.cpp:780: instantiated from here /usr/include/boost/python/detail/invoke.hpp:75: error: no match for call to '(const boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<const hapl::Haplotype*>) (const hapl::Haplotype*)' this is strange for me bacause I'm sure I listed all methods returning mentioned types. There is also one more type that doesn't cause warning: '(const hapl::Genotype*' So I guess this problem may be caused by typedef declaration in my header files: typedef std::map<const Haplotype*,double> ProbHaplotype; typedef std::map<const Fenotype*,double> ProbFenotype; typedef std::map<const Genotype*,double> ProbGenotype; and: typedef std::set<const Fenotype*> ObsFenotypes; typedef std::set<const Genotype*> ObsGenotypes; typedef std::set<const Haplotype*> ObsHaplotypes; STL generic containers can generate methods returning problematic types so i cannot see it in my headers. To solve this problem I replaced lines with call polices mentioned above by: mb.member_functions(return_type='hapl::Fenotype const *').call_policies = module_builder.call_policies.return_internal_reference() mb.member_functions(return_type='hapl::Haplotype const *').call_policies = module_builder.call_policies.return_internal_reference() mb.member_functions(return_type='hapl::Genotype const *').call_policies = module_builder.call_policies.return_internal_reference() but this causes run time error: Traceback (most recent call last): File "makewindow.py", line 27, in <module> mb.member_functions(return_type='hapl::Fenotype const *').call_policies = module_builder.call_policies.return_internal_reference() File "/usr/lib/python2.5/site-packages/pyplusplus/module_builder/builder.py", line 564, in member_functions , recursive=recursive) File "/usr/lib/python2.5/site-packages/pygccxml/declarations/scopedef.py", line 518, in member_functions , allow_empty=allow_empty) File "/usr/lib/python2.5/site-packages/pygccxml/declarations/scopedef.py", line 374, in _find_multiple raise RuntimeError( "Multi declaration query returned 0 declarations." ) RuntimeError: Multi declaration query returned 0 declarations. So what shuld I do to get clean complation without errors? -- Regards Michał Nowotka _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig