|
|
|
Extending and Embedding the Python Interpreter |
|
|
|
1.5 Compilation and Linkage
There are two more things to do before you can use your new extension:
compiling and linking it with the Python system. If you use dynamic
loading, the details may depend on the style of dynamic loading your
system uses; see the chapters about building extension modules
(chapter 3) and additional information that pertains only
to building on Windows (chapter 4) for more
information about this.
If you can't use dynamic loading, or if you want to make your module a
permanent part of the Python interpreter, you will have to change the
configuration setup and rebuild the interpreter. Luckily, this is
very simple on Unix: just place your file (spammodule.c for
example) in the Modules/ directory of an unpacked source
distribution, add a line to the file Modules/Setup.local
describing your file:
and rebuild the interpreter by running make in the toplevel
directory. You can also run make in the Modules/
subdirectory, but then you must first rebuild Makefile
there by running `make Makefile'. (This is necessary each
time you change the Setup file.)
If your module requires additional libraries to link with, these can
be listed on the line in the configuration file as well, for instance:
Release 2.5.2, documentation updated on 21st February, 2008.
See About this document... for information on suggesting changes.
|