Compiling and loading Python C extensions
The Python interpreter is able to load extensions from dynamic/shared libraries such as Python modules if they provide an applicable interface using the Python/C API. The definition of all functions, types, and macros constituting the Python/C API is included in a
Python.h C header file that is distributed with Python sources. In many distributions of Linux, this header file is contained in a separate package (for example,
python-dev in Debian/Ubuntu) but under Windows, it is distributed by default with the interpreter. On POSIX and POSIX-compatible systems (for example, Linux and macOS), it can be found in the
include/ directory of your Python installation. On Windows, it can be found in the
Include/ directory of your Python installation.
The Python/C API traditionally changes with every release of Python. In most cases, these are only additions of new features to the API so are generally source-compatible. Anyway, in most cases, they...