| 1 |
.. highlight:: c |
| 2 |
|
| 3 |
.. _building: |
| 4 |
|
| 5 |
***************************** |
| 6 |
Building C and C++ Extensions |
| 7 |
***************************** |
| 8 |
|
| 9 |
A C extension for CPython is a shared library (for example, a ``.so`` file on |
| 10 |
Linux, ``.pyd`` on Windows), which exports an *initialization function*. |
| 11 |
|
| 12 |
See :ref:`extension-modules` for details. |
| 13 |
|
| 14 |
|
| 15 |
.. highlight:: c |
| 16 |
|
| 17 |
.. _install-index: |
| 18 |
.. _setuptools-index: |
| 19 |
|
| 20 |
Building C and C++ Extensions with setuptools |
| 21 |
============================================= |
| 22 |
|
| 23 |
|
| 24 |
Building, packaging and distributing extension modules is best done with |
| 25 |
third-party tools, and is out of scope of this document. |
| 26 |
One suitable tool is Setuptools, whose documentation can be found at |
| 27 |
https://setuptools.pypa.io/en/latest/setuptools.html. |
| 28 |
|
| 29 |
The :mod:`distutils` module, which was included in the standard library |
| 30 |
until Python 3.12, is now maintained as part of Setuptools. |