-qstaticlink

Category

Linking

Pragma equivalent

None.

Purpose

Controls how shared and nonshared runtime libraries are linked into an application.

When -qstaticlink is in effect, the compiler links only static libraries with the object file being produced. When -qnostaticlink is in effect, the compiler links shared libraries with the object file being produced.

This option provides the ability to specify linking rules that are equivalent to those implied by the GNU options -static, -static-libgcc, and -shared-libgcc, used singly and in combination.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-nostaticlink-.                  
>>- -q--+-staticlink---+--+-----------+------------------------><
                          '-=--libgcc-'   

Defaults

-qnostaticlink

Parameters

libgcc
When libgcc is specified together with nostaticlink, the compiler links to the shared version of libgcc. When libgcc is specified together with staticlink, the compiler links to the static version of libgcc.

Usage

Important: Any use of third-party libraries or products is subject to the provisions in their respective licenses. Using the -qstaticlink option can have significant legal consequences for the programs that you compile. It is strongly recommended that you seek legal advice before using this option.

The following table shows the equivalent GNU and XL C/C++XL Fortran options for specifying linkage of shared and nonshared libraries.
Table 1. Option mappings: control of the GNU linker
GNU option Meaning XL Fortran option
-shared Build a shared object. -qmkshrobj
-static Build a static object and prevent linking with shared libraries. Every library linked to must be a static library. -qstaticlink
-shared-libgcc Link with the shared version of libgcc. -qnostaticlink or -qnostaticlink=libgcc (these two are identical)
Note: This is the default setting on SUSE Linux® Enterprise Server (SLES) and Red Hat Enterprise Linux (RHEL).
-static-libgcc Link with the static version of libgcc. You can still link your shared libraries. -qstaticlink=libgcc
Note: Options -qmkshrobj and -qstaticlink are incompatible and cannot be specified together.

Predefined macros

None.

Related information