The CC driver provides several options to help you use libraries.
Use the -mt option compile and link multithreaded code.
Use the -xia option to link the interval arithmetic libraries.
Use the -xlang option to link Fortran runtime libraries.
To use the classic-iostreams form of librwtool, use the -library=rwtools7 option. To use the standard-iostreams form of librwtool, use the -library=rwtools7_std option.
The following command links the classic-iostreams form of Tools.h++ version 7 and libiostream libraries dynamically.
example% CC test.cc -library=rwtools7,iostream
The following command links the libgc library statically.
example% CC test.cc -library=gc -staticlib=gc
The following command compiles test.cc in compatibility mode and links libC statically. Because libC is linked by default in compatibility mode, you are not required to specify this library using the– library option.
example% CC test.cc -compat=4 -staticlib=libC
The following command excludes the libraries libCrun and libCstd, which would otherwise be included by default.
example% CC test.cc -library=no%Crun,no%Cstd
By default, CC links various sets of system libraries depending on the command line options. If you specify -xnolib (or -nolib), CC links only those libraries that are specified explicitly with the -l option on the command line. (When -xnolib or -nolib is used, the -library option is ignored, if present.)
The –R option allows you to build dynamic library search paths into the executable file. At execution time, the runtime linker searches these paths for the shared libraries needed by the application. The CC driver passes– R/opt/SUNWspro/lib to ld by default (if the compiler is installed in the standard location). You can use -norunpath to disable building the default path for shared libraries into the executable.