Extension modules are usually compiled into shared libraries or DLLs that can be dynamically loaded by the interpreter. The low-level details of this process vary on every machine, but the distutils module in the Python library can be used to simplify the process. To create an extension module using distutils, follow these steps:
Create a file called setup.py that starts with the following code:
# setup.py from distutils.core import setup, Extension
Next, add some source information about your extension, as follows:
setup(name="spam", version="1.0", ext_modules=[Extension("spam", ["spam.c", "spamwrapper.c"])])
Now, to build your extension, type the following:
python setup.py build
At this point, a shared ...