Jump to content

  • Log In with Google      Sign In   
  • Create Account


Boost.Python - Ignoring return types of member functions?

  • You cannot reply to this topic
2 replies to this topic

#1 TheComet   Members   -  Reputation: 1388

Like
1Likes
Like

Posted 30 June 2014 - 07:47 AM

I have two unrelated questions.

 

1) Consider the following C++ class and its wrapping code using Boost.Python:

struct Foo
{
    InternalThing* bar(std::string name);
};

BOOST_PYTHON_MODULE(test)
{
    using namespace boost::python;
    class_<Foo>("Foo")
        .def("bar", &Foo::bar)
    ;
}

InternalThing is a class that is not wrapped and has no reason to be exposed, consequently generating a compile error because Boost.Python can't find it.

 

How can I tell Boost.Python to ignore the return type and just assume it to be void?

 

 

2) When I tested the compiled shared object in Python (using PyCharm), I noticed that PyCharm's autocomplete doesn't know about any of the available classes/methods. Is there a way to expose that kind of information to PyCharm, perhaps through a .py stub file?


YOUR_OPINION >/dev/null


Sponsor:

#2 Eck   Members   -  Reputation: 1751

Like
0Likes
Like

Posted 30 June 2014 - 09:54 AM

I'm not sure if you can or not, I'll let someone who knows more about Boost.Python speak to that. But one thing you could do is create a bar_Python function that IS a void return type which calls your bar function. You probably already thought of that, but just in case you didn't. :)

 

- Eck



#3 TheComet   Members   -  Reputation: 1388

Like
0Likes
Like

Posted 30 June 2014 - 01:47 PM


But one thing you could do is create a bar_Python function that IS a void return type which calls your bar function. You probably already thought of that, but just in case you didn't. smile.png

Thanks for your input.

 

I was thinking about doing that as a last resort, hoping that there is a more elegant solution.


YOUR_OPINION >/dev/null






PARTNERS