C/C++ Programmer's Guide (G06.25+)
Compiler Pragmas
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
13-12
CALL_SHARED
CALL_SHARED
The CALL_SHARED pragma directs the native C and C++ compilers to generate shared 
code, which is PIC (Position-Independent Code). The loadfile that results can access 
PIC library files (DLLs).
Compare the action of CALL_SHARED with that of the two related pragmas:
•
NON_SHARED directs the compiler to generate a TNS/R non-PIC loadfile that 
cannot be shared and cannot access PIC files.
•
SHARED directs the compiler to generate PIC and to invoke the eld or ld linker 
to create a PIC library file. 
The pragma default settings are:
Usage Guidelines
•
The CALL_SHARED pragma can appear only on the RUN command line for NMC 
or NMCPLUS (G-series Guardian) or for CCOMP or CPPCOMP (H-series 
Guardian). The OSS equivalent (-Wcall_shared) can appear only on the 
command line for the c89 utility. 
•
On Guardian, the default behavior of CALL_SHARED is to not call the eld or ld 
linker. The 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 CALL_SHARED, the compilation results in a PIC linkable object 
file (a PIC linkfile).
°
If you include both the CALL_SHARED and RUNNABLE pragmas, the 
compilation results in a PIC executable object file (a PIC loadfile) from the eld 
or ld linker.
•
On OSS, the default behavior of the -Wcall_shared flag is to automatically call 
the eld or ld linker.
CALL_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:
CALL_SHARED
TNS/R code: 
NON_SHARED
TNS/E code:
CALL_SHARED
TNS/E native C and C++ compilers CALL_SHARED CALL_SHARED










