Jump to content
  • Advertisement
Sign in to follow this  
TheComet

Boost.Python - Ignoring return types of member functions?

This topic is 1450 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
Share on other sites


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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!