Package distutils :: Module unixccompiler :: Class UnixCCompiler

[frames | no frames]

## Class UnixCCompiler

    CCompiler --+
                |
               UnixCCompiler

Method Summary
| ``create_static_lib`(self, objects, output_libname, output_dir, debug, target_lang)` Link a bunch of stuff together to create a static library file.
| ``find_library_file`(self, dirs, lib, debug)` Search the specified list of directories for a static or shared library file 'lib' and return the full path to that file.
| ``library_dir_option`(self, dir)` Return the compiler option to add 'dir' to the list of directories searched for libraries.
| ``library_option`(self, lib)` Return the compiler option to add 'dir' to the list of libraries linked into the shared library or executable.
| ``link`(self, target_desc, objects, output_filename, output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols, debug, extra_preargs, extra_postargs, build_temp, target_lang)` Link a bunch of stuff together to create an executable or shared library file.
| ``preprocess`(self, source, output_file, macros, include_dirs, extra_preargs, extra_postargs)` Preprocess a single C/C++ source file, named in 'source'.
| ``runtime_library_dir_option`(self, dir)` Return the compiler option to add 'dir' to the list of directories searched for runtime libraries.

Class Variable Summary
`str` | `compiler_type` = `'unix'`
`str` | `dylib_lib_extension` = `'.dylib'`
`str` | `dylib_lib_format` = `'lib%s%s'`
`dict` | `executables` = `{'compiler_cxx': ['cc'], 'ranlib': None, '...`
`str` | `obj_extension` = `'.o'`
`str` | `shared_lib_extension` = `'.so'`
`str` | `shared_lib_format` = `'lib%s%s'`
`list` | `src_extensions` = `['.c', '.C', '.cc', '.cxx', '.cpp', '.m...`
`str` | `static_lib_extension` = `'.a'`
`str` | `static_lib_format` = `'lib%s%s'`

Method Details

### create_static_lib(self, objects, output_libname, output_dir=None, debug=0, target_lang=None)

Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries supplied to 'add_library()' and/or 'set_libraries()', and the libraries supplied as 'libraries' (if any).

'output_libname' should be a library name, not a filename; the filename will be inferred from the library name. 'output_dir' is the directory where the library file will be put.

'debug' is a boolean; if true, debugging information will be included in the library (note that on most platforms, it is the compile step where this matters: the 'debug' flag is included here just for consistency).

'target_lang' is the target language for which the given objects are being compiled. This allows specific linkage time treatment of certain languages.

Raises LibError on failure.

  Overrides:
    `distutils.ccompiler.CCompiler.create_static_lib` (inherited documentation)

### find_library_file(self, dirs, lib, debug=0)

Search the specified list of directories for a static or shared library file 'lib' and return the full path to that file. If 'debug' true, look for a debugging version (if that makes sense on the current platform). Return None if 'lib' wasn't found in any of the specified directories.

  Overrides:
    `distutils.ccompiler.CCompiler.find_library_file` (inherited documentation)

### library_dir_option(self, dir)

Return the compiler option to add 'dir' to the list of directories searched for libraries.

  Overrides:
    `distutils.ccompiler.CCompiler.library_dir_option` (inherited documentation)

### library_option(self, lib)

Return the compiler option to add 'dir' to the list of libraries linked into the shared library or executable.

  Overrides:
    `distutils.ccompiler.CCompiler.library_option` (inherited documentation)

### link(self, target_desc, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None)

Link a bunch of stuff together to create an executable or shared library file.

The "bunch of stuff" consists of the list of object files supplied as 'objects'. 'output_filename' should be a filename. If 'output_dir' is supplied, 'output_filename' is relative to it (i.e. 'output_filename' can provide directory components if needed).

'libraries' is a list of libraries to link against. These are library names, not filenames, since they're translated into filenames in a platform-specific way (eg. "foo" becomes "libfoo.a" on Unix and "foo.lib" on DOS/Windows). However, they can include a directory component, which means the linker will look in that specific directory rather than searching all the normal locations.

'library_dirs', if supplied, should be a list of directories to search for libraries that were specified as bare library names (ie. no directory component). These are on top of the system default and those supplied to 'add_library_dir()' and/or 'set_library_dirs()'. 'runtime_library_dirs' is a list of directories that will be embedded into the shared library and used to search for other shared libraries that it depends on at run-time. (This may only be relevant on Unix.)

'export_symbols' is a list of symbols that the shared library will export. (This appears to be relevant only on Windows.)

'debug' is as for 'compile()' and 'create_static_lib()', with the slight distinction that it actually matters on most platforms (as opposed to 'create_static_lib()', which includes a 'debug' flag mostly for form's sake).

'extra_preargs' and 'extra_postargs' are as for 'compile()' (except of course that they supply command-line arguments for the particular linker being used).

'target_lang' is the target language for which the given objects are being compiled. This allows specific linkage time treatment of certain languages.

Raises LinkError on failure.

  Overrides:
    `distutils.ccompiler.CCompiler.link` (inherited documentation)

### preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None)

Preprocess a single C/C++ source file, named in 'source'. Output will be written to file named 'output_file', or stdout if 'output_file' not supplied. 'macros' is a list of macro definitions as for 'compile()', which will augment the macros set with 'define_macro()' and 'undefine_macro()'. 'include_dirs' is a list of directory names that will be added to the default list.

Raises PreprocessError on failure.

  Overrides:
    `distutils.ccompiler.CCompiler.preprocess` (inherited documentation)

### runtime_library_dir_option(self, dir)

Return the compiler option to add 'dir' to the list of directories searched for runtime libraries.

  Overrides:
    `distutils.ccompiler.CCompiler.runtime_library_dir_option` (inherited documentation)

Class Variable Details

### compiler_type

  Type:
    `str`
  Value:

        'unix'

### dylib_lib_extension

  Type:
    `str`
  Value:

        '.dylib'

### dylib_lib_format

  Type:
    `str`
  Value:

        'lib%s%s'

### executables

  Type:
    `dict`
  Value:

        {'archiver': ['ar', '-cr'],
         'compiler': ['cc'],
         'compiler_cxx': ['cc'],
         'compiler_so': ['cc'],
         'linker_exe': ['cc'],
         'linker_so': ['cc', '-shared'],
         'preprocessor': None,
         'ranlib': None}

### obj_extension

  Type:
    `str`
  Value:

        '.o'

### shared_lib_extension

  Type:
    `str`
  Value:

        '.so'

### shared_lib_format

  Type:
    `str`
  Value:

        'lib%s%s'

### src_extensions

  Type:
    `list`
  Value:

        ['.c', '.C', '.cc', '.cxx', '.cpp', '.m']

### static_lib_extension

  Type:
    `str`
  Value:

        '.a'

### static_lib_format

  Type:
    `str`
  Value:

        'lib%s%s'

Generated by Epydoc 2.1.20050511.rpd on Wed Sep 26 13:46:25 2007 | http://epydoc.sf.net