Sun Studio 12: C++ User's Guide

A.2.49.1 Values

For compatibility mode (–compat[-4]]), l must be one of the following values.

Table A–16 The -library Values for Compatibility Mode

Value 

Meaning  

[no%]f77

Deprecated. Use -xlang=f77 instead.

[no%]f90

Deprecated. Use -xlang=f90 instead.

[no%]f95

Deprecated. Use -xlang=f95 instead.

[no%]rwtools7

[Do not] Use classic-iostreams Tools.h++ version 7.

[no%]rwtools7_dbg

[Do not] Use debug-enabled Tools.h++ version 7.

[no%]complex

[Do not] Use libcomplex for complex arithmetic.

[no%]interval

Deprecated. Do not use. Use -xia.

[no%]libC

[Do not] Use libC, the C++ support library.

[no%]gc

[Do not] Use libgc, garbage collection.

[no%]sunperf

[Do not] Use the Sun Performance LibraryTM

%none

Use no C++ libraries except for libC.

For standard mode (the default mode), l must be one of the following:

Table A–17 The -library Values for Standard Mode

Value 

Meaning  

[no%]f77

Deprecated. Use -xlang=f77 instead.

[no%]f90

Deprecated. Use -xlang=f90 instead.

[no%]f95

Deprecated. Use -xlang=f95 instead.

[no%]rwtools7

[Do not] Use classic-iostreams Tools.h++ version 7.

[no%]rwtools7_dbg

[Do not] Use debug-enabled Tools.h++ version 7.

[no%]rwtools7_std

[Do not] Use standard-iostreams Tools.h++ version 7.

[no%]rwtools7_std_dbg

[Do not] Use debug-enabled standard-iostreams Tools.h++ version 7.

[no%]interval

Deprecated. Do not use. Use -xia.

[no%]iostream

[Do not] Use libiostream, the classic iostreams library.

[no%]Cstd

[Do not] Use libCstd, the C++ standard library. [Do not] Include the compiler-provided C++ standard library header files.

[no%]Crun

[Do not] Use libCrun, the C++ runtime library.

[no%]gc

[Do not] Use libgc, garbage collection.

[no%]stlport4

[Do not] Use STLport’s Standard Library implementation version 4.5.3 instead of the default libCstd. For more information about using STLport’s implementation, see 13.3 STLport.

[no%]stlport4_dbg

[Do not] Use STLport’s debug-enabled library. 

[no%]sunperf

[Do not] Use the Sun Performance Library. 

%none

Use no C++ libraries, except for libCrun.

Defaults

Examples

To link in standard mode without any C++ libraries (except libCrun), use:


example% CC -library=%none

To include the classic-iostreams Rogue Wave tools.h++ library in standard mode:


example% CC –library=rwtools7,iostream

To include the standard-iostreams Rogue Wave tools.h++ library in standard mode:


example% CC -library=rwtools7_std

To include the classic-iostreams Rogue Wave tools.h++ library in compatibility mode:


example% CC -compat -library=rwtools7

Interactions

If a library is specified with -library, the proper –I paths are set during compilation. The proper –L, –Y P, –R paths and –l options are set during linking.

This option accumulates instead of overrides.

When you use the interval arithmetic libraries, you must include one of the following libraries: libC, libCstd, or libiostream.

Use of the -library option ensures that the -l options for the specified libraries are emitted in the right order. For example, the -l options are passed to ld in the order -lrwtool -liostream for both -library=rwtools7,iostream and -library=iostream,rwtools7.

The specified libraries are linked before the system support libraries are linked.

You cannot use -library=sunperf and -xlic_lib=sunperf on the same command line.

You cannot use -library=stlport4 and -library=Cstd on the same command line.

Only one Rogue Wave tools library can be used at a time and you cannot use any Rogue Wave tools library with -library=stlport4.

When you include the classic-iostreams Rogue Wave tools library in standard mode (the default mode), you must also include libiostream (see the C++ Migration Guide for additional information). You can use the standard-iostreams Rogue Wave tools library in standard mode only. The following command examples show both valid and invalid use of the Rogue Wave tools.h++ library options.


% CC -compat -library=rwtools7 foo.cc        <-- valid
% CC -compat -library=rwtools7_std foo.cc    <-- invalid

% CC -library=rwtools7,iostream foo.cc       <-- valid, classic iostreams
% CC -library=rwtools7 foo.cc                <-- invalid

% CC -library=rwtools7_std foo.cc            <-- valid, standard iostreams
% CC -library=rwtools7_std,iostream foo.cc   <-- invalid

If you include both libCstd and libiostream, you must be careful to not use the old and new forms of iostreams (for example, cout and std::cout) within a program to access the same file. Mixing standard iostreams and classic iostreams in the same program is likely to cause problems if the same file is accessed from both classic and standard iostream code.

Programs linking neither libC nor libCrun might not use all features of the C++ language.

If -xnolib is specified, -library is ignored.

Warnings

If you compile and link in separate steps, the set of -library options that appear in the compile command must appear in the link command.

The stlport4, Cstd and iostream libraries provide their own implementation of I/O streams. Specifying more than one of these with the -library option can result in undefined program behavior. For more information about using STLport’s implementation, see 13.3 STLport.

The set of libraries is not stable and might change from release to release.

See also

–I, –l, –R, –staticlib, -xia, -xlang, –xnolib, 11.4.8 An Example Application, Caveats:, 13.3.1 Redistribution and Supported STLport Libraries, 2.7.3.3 Using make With Standard Library Header Files, Tools.h++ User’s Guide, Tools.h++ Class Library Reference, Standard C++ Class Library Reference, C++ Interval Arithmetic Programming Reference.

For information on using the -library=no%cstd option to enable use of your own C++ standard library, see 12.7 Replacing the C++ Standard Library.