C++ User's Guide

-xnolib

Disables linking with default system libraries.

Normally (without this option) the C++ compiler links with several system libraries to support C++ programs. With this option, the -llib options to link the default system support libraries are not passed to ld.

Normally, the compiler links with the following libraries in the following order:

For compat=4:

-lC -lC_mtstubs -lm -lw -lcx -lc

For compat=5:

-lCstd -lCrun -lC_mtstubs -lm -lw -lcx -lc

The order of the -l options is significant. The -lm, -lw,and -lcx options must appear before -lc.


Note -

If the -mt compiler option is specified, then -lthread is passed instead of -lC_mtstubs.


Examples

For minimal compilation to meet the C application binary interface (that is, a C++ program with only C support required) use:

demo% CC -xnolib test.cc -lc

To link libm statically into a single-threaded application on SPARC V8 architecure, use:

demo% CC -xnolib -Bstatic -lm -Bdynamic -lC_mtstubs -lw -lcx -lc

To link libm and libw statically, and link others dynamically:

demo% CC -xnolib -Bstatic -lm -lw -Bdynamic -lcx -lc

Interactions

If you specify -xnolib, you must manually link all required system support libraries in the given order. You must link the system support libraries last.

If -xnolib is specified, -library is ignored.

Warnings

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

-lcx is not present in 64-bit compilation modes.

See also

-library, -staticlib, -l