C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
13-67
NON_SHARED
NON_SHARED
The NON_SHARED pragma directs the native C and C++ compilers to generate non-
shared code (that is, not PIC (Position-Independent Code).
Compare the action of NON_SHARED with that of the two related pragmas:
CALL_SHARED directs the compiler to generate PIC.
SHARED directs the compiler to generate PIC and to invoke the ld linker to create
a PIC library file.
The pragma default settings are:
Usage Guidelines
On Guardian environment, the NON_SHARED pragma can appear only on the RUN
command line for NMC or NMCPLUS. On OSS environment, the -Wnon_shared
option can appear only on the RUN command line for the c89 utility when the nld
utility is used.
On TNS/R Guardian environment, the default behavior of NON_SHARED is to not
call the ld linker. The TNS/R native C or C++ driver only calls the linker if you also
specify either RUNNABLE or LINKFILE, or if you specify SHARED.
°
If you specify NON_SHARED, the compilation results in a non-PIC linkable
object file (a linkfile).
°
If you include both the NON_SHARED and RUNNABLE pragmas, the compilation
results in a non-PIC executable object file (a loadfile) from the nld linker.
On TNS/R OSS, the default behavior of the -non_shared option is to
automatically call the nld linker.
°
If you specify -Wnon_shared, the compilation results in a non-PIC executable
object file (loadfile).
NON_SHARED
SYSTYPE GUARDIAN SYSTYPE OSS
TNS C compiler N.A. N.A.
G-series TNS c89 utility N.A. N.A.
TNS/R native C and C++ compilers NON_SHARED NON_SHARED
Native c89 utility TNS/R code:
NON_SHARED
TNS/E code:
N.A.
TNS/R code:
NON_SHARED
TNS/E code:
N.A.
TNS/E native C and C++ compilers N.A. N.A.