• Advertisement
Sign in to follow this  

Python and C++

This topic is 3597 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

Hi, Im looking into using Python as my scripting language, for a C++ Project im doing. But i was wondering how well Python and C++ interact with each other? Is it possible to access a C++ class through python? Is it fast? and is it reliable? I tried looking up on google if a Python class could some how point to a C++ class, but could not find anything on it. Thanks for the help in Advanced, Lordcorm

Share this post


Link to post
Share on other sites
Advertisement
It's possible to have C++ and Python objects and classes interact. Generally you'll want to use a library like boost::python or SWIG to handle most of the heavy lifting for getting them to talk to each other. Otherwise you need to use the Python C API for most interaction. I personally prefer boost::python.

Speed is usually "fast enough" and there isn't anything inherently unreliable about it. However, you do need to pay attention to normal C++ rules about making sure your references and pointers stay valid and such like.

Share this post


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

  • Advertisement