Sun Studio 12: C++ User's Guide

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.