C++ User's Guide

-G

Build a dynamic shared library instead of an executable file.

All source files specified in the command line are compiled with -Kpic by default.

When building a shared library that uses templates, it is necessary in most cases to include in the shared library those template functions that are instantiated in the template data base. Using this option automatically adds those templates to the shared library as needed.

Interactions

The following options are passed to ld if -c (the compile-only option) is not specified:

Warnings

Do not use ld -G to build shared libraries; use CC-G. The CC driver automatically passes several options to ld that are needed for C++.

See also

-dy, -Kpic, -xcode=pic13, -xildoff, -ztext, ld(1) man page, C++ Library Reference.