Awasu » Embedding Python
Sunday 30th November 2014 8:26 AM

This series of tutorials explains how to embed Python into your C/C++ program.

Compiling the Python interpreter

How to compile Python from its source code, to create the binaries that will be linked in to your program.

Adding the Python interpreter to your program

How to link the Python binaries into your program, and what else needs to be done to get everything up and running.

Calling Python code from your program

How to call Python code from your C/C++ program, including passing data in, and getting the results out.

Using Python in a multi-threaded program

We look at some of the issues when using Python in a multi-threaded program.

Handling errors

How to handle errors raised by the Python interpreter.

Writing a C++ wrapper library

In this section, we write a C++ wrapper library around the Python interpreter.

Distributing your program

What you need to distribute with your program for Python to work.



There is also a companion tutorial that shows how to go the other way, and extend Python by adding custom C/C++ code.

Download the full source code here.

Have your say