Next: SGI dynamic loading Up: Building a dynamically Previous: Building a dynamically

Shared libraries

You must link the `.o' file to produce a shared library. This is done using a special invocation of the Unix loader/linker, ld(1). Unfortunately the invocation differs slightly per system.

On SunOS 4, use


    ld foomodule.o -o foomodule.so

On Solaris 2, use


    ld -G foomodule.o -o foomodule.so

On SGI IRIX 5, use


    ld -shared foomodule.o -o foomodule.so

On other systems, consult the manual page for ld(1) to find what flags, if any, must be used.

If your extension module uses system libraries that haven't already been linked with Python (e.g. a windowing system), these must be passed to the ld command as `-l' options after the `.o' file.

The resulting file `foomodule.so' must be copied into a directory along the Python module search path.


guido@cwi.nl