Since there are three styles of dynamic loading, there are also three
groups of instructions for building a dynamically loadable module.
Instructions common for all three styles are given first. Assuming
your module is called foo
, the source filename must be
`foomodule.c
', so the object name is `foomodule.o
'. The
module must be written as a normal Python extension module (as
described earlier).
Note that in all cases you will have to create your own Makefile that
compiles your module file(s). This Makefile will have to pass two
`-I' arguments to the C compiler which will make it find the
Python header files. If the Make variable PYTHONTOP points to
the toplevel Python directory, your CFLAGS Make variable should
contain the options `-I$(PYTHONTOP) -I$(PYTHONTOP)/Include'.
(Most header files are in the `Include
' subdirectory, but the
`config.h
' header lives in the toplevel directory.) You must
also add `-DHAVE_CONFIG_H' to the definition of CFLAGS to
direct the Python headers to include `config.h
'.