
Detecting the Python library
The use of Python tools to analyze and manipulate output from compiled programs is nowadays widespread. However, there are also other, more powerful ways of combining an interpreted language such as Python with compiled languages such as C or C++. One way is to extend Python by providing new types and new functionalities on these types via C or C++ modules, compiled into shared libraries. This will be the topic of recipes in Chapter 9, Mixed-language Projects. Another approach is to embed the Python interpreter into a C or C++ program. Both approaches require the following:
- A working version of the Python interpreter
- The availability of the Python header file Python.h
- The Python runtime library libpython
All three components have to be pinned to the exact same version. We have demonstrated how to find the Python interpreter; in this recipe, we will show how to find the two missing ingredients for a successful embedding.