C++ User's Guide

-Bbinding

Allows dynamic or requires static library linking.

This option specifies whether the linker should look for dynamic (shared) libraries or for static (archive) libraries. You can use the -B option to toggle several times on a command line. This option is passed to the linker, ld.


Note -

On the Solaris 7 platform, not all libraries available as static libraries.


Values

binding must be one of the following:

Value of binding

Meaning 

dynamic

 

Directs the link editor to look for liblib.so (shared) files, and if they are not found, to look for liblib.a (static, nonshared) files. Use this option if you want shared library bindings for linking.

static

 

Directs the link editor to look only for liblib.a (static, nonshared) files. Use this option if you want nonshared library bindings for linking.

(No space is allowed between -B and dynamic or static.)

Defaults

If -B is not specified, -Bdynamic is assumed.

Interactions

To link the C++ default libraries statically, use the -staticlib option.

This option affects the linking of libraries provided by default. To ensure that default libraries are linked dynamically, the last use of -B should be -Bdynamic.

Examples

The following compiler command links libfoo.a even if libfoo.so exists; all other libraries are linked dynamically:

demo% CC a.o -Bstatic -lfoo -Bdynamic

See also

-nolib, -staticlib, ld(1), "Statically Linking Standard Libraries", Linker and Libraries Guide