OOF2: The Manual

Name

oof2extutils.SharedLibrary — Describe an OOF2 shared library

Synopsis

from oof2extutils import SharedLibrary
SharedLibrary(name,
              sources,
              language='c++',
              include_dirs=None,
              macros=None,
              extra_compile_args=None,
              libraries=None,
              library_dirs=None,
              extra_link_args=None)
	  

Description

The oof2extutils.SharedLibrary class is analogous to oof2extutils.Extension. It contains the information required for distutils to build a shared library. The libraries built by SharedLibrary contain the heart of an OOF2 extension — the C++ routines in the library are invoked by the wrapper routines (in the Python extension modules) that are called by OOF2's Python front end.

Tools for building shared libraries like these are not actually part of the distutils library. OOF2 contains a build_shlib extension to distutils, which is installed when oof2extutils is imported. The oof2extutils.SharedLibrary class is actually derived from a more general shlib.build_shlib.SharedLibrary class, just as oof2extutils.Extension is derived from distutils.core.Extension.

Parameters

Because SharedLibrary is not derived from a standard distutils class, all of its parameters are listed here, even those that are identical to those in the base class. For the curious, the SharedLibrary base class and the build_shlib distutils command can be found in the shlib subdirectory in the OOF2 distribution.

The only required arguments are name and sources. The rest are optional.

name

The name of the library. The actual file created will have a 'lib' prefix and an appropriate suffix (usually, but not always, '.so').

sources

A list of C or C++ source files. The file names must be given relative to the current directory (the directory containing setup.py).

language

The language of the source files. The default value, if omitted, is 'c++'.

include_dirs

A list of directories to search for header files. The directories containing the OOF2 source code, the directory containing oofconfig.h, and the directory containing the Python API headers are included automatically.

macros

A list of preprocessor macros to define.

extra_compile_args

A list of additional arguments to pass to the compiler. distutils tries to use a reasonable set of arguments, so in most cases it should be possible to omit extra_compile_args.

libraries

A list of libraries that the final shared library should link to. The main OOF2 libraries are included automatically. Library names should be given without the 'lib' prefix or any '.so' or '.dylib' suffix.

library_dirs

A list of directories in which to search for libraries. The location of the main OOF2 libraries is included automatically.

extra_link_args

A list of any additional arguments that need to be passed to the linker.