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

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.
CALL_SHARED
The pragma default settings are:
SYSTYPE OSSSYSTYPE GUARDIAN
N.A.N.A.TNS C compiler
N.A.N.A.G-series TNS c89 utility
NON_SHAREDNON_SHAREDTNS/R native C and C++ compilers
TNS/R code: NON_SHAREDTNS/E
code: CALL_SHARED
TNS/R code: NON_SHAREDTNS/E
code: CALL_SHARED
Native c89 and c99 utilities
CALL_SHAREDCALL_SHAREDTNS/E native C and C++ compilers
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 or J-series Guardian). The OSS
equivalent (-Wcall_shared) can appear only on the command line for the c89 or the c99
utility.
On Guardian environment, 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.
In the OSS file system, the default behavior of the -Wcall_shared flag is to automatically
call the eld or ld linker.
If you specify -Wcall_shared, the compilation results in a PIC executable object file
(a PIC loadfile).
If you specify the -c option with -Wcall_shared, the linker is not called, and the result
is a PIC linkable object file (a PIC linkfile).
If you specify the CALL_SHARED pragma, the compiler driver passes these to the eld or ld
linker:
For a TNS/R program, CCPPMAIN (Guardian) or ccppmain.o (On OSS environment or
PC)
For a TNS/E program, CCPLMAIN (Guardian) or ccplmain.o (On OSS environment or
PC)
CALL_SHARED 177