• Forum
  • Lounge
  • How can i embed python in my c++ program

How can i embed python in my c++ program?

I'm really addicted to python, it's easily my favorite programming language. I was wondering, is there a way i can like somehow 'embed' python in my C++ source code so that i can use both at the same time in the same program? i heard it's possible, if so then how?
I don't think that's possible :o
...now why would you want embed Python in C++?

Last edited on
Yes you can, but you need to use the Python API. You can also use Boost.Python which may simplify the Python API somewhat, because the Python API is kind of ugly.

To make your program scriptable so that e.g. users can modify its behaviour without having access to the source code or so you can do so without having to recompile the program. You may also want to take complicated, but not performance-critical, parts of your C++ code out and write them in Python instead. You can also use it for plugins. Games sometimes use it for scripting things too.
Last edited on
Thanks Chris ;)
Topic archived. No new replies allowed.