C/C++ Programmer's Guide (G06.25+)
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
13-68
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, the NON_SHARED pragma can appear only on the RUN command
line for NMC or NMCPLUS. On OSS, 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, 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 OSS, the default behavior of the -Wnon_shared option for TNS/R code is to
automatically call the nld linker.
°
If you specify -Wnon_shared, the compilation results in a non-PIC executable
object file (loadfile).
°
If you specify the -c option with -Wnon_shared, the linker is not called, and
the result is a non-PIC linkable object file (linkfile).
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.