CRE Programmer's Guide
Compiling and Linking Programs for the Native CRE
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
4-4
Linking Modules
•
When the main routine is written in TNS/E native C, link in the TNS/E native C run-
time library object file, CCPLMAIN
Unlike the Binder product, the native linker utilities do not perform any special checking
for mixed-language programs or programs that use the CRE.
Examples of Compiling and Linking
1. In this example, the pTAL compiler compiles the pTAL source file PTALSRC and
generates the object file PTALOBJ. Then the native C compiler compiles the C
source file CSRC and generates the object file COBJ. Finally the LD utility links the
PTALOBJ and COBJ files with the CRE and C run-time library hybrid SRLs and C
run-time library object file and produces the executable file MYEXEC:
PTAL / IN PTALSRC, OUT $S.#TEST / PTALOBJ
NMC / IN CSRC, OUT $S.#TEST / COBJ
LD $SYSTEM.SYSTEM.CRTLMAIN PTALOBJ COBJ -O MYEXEC &
-LIB $SYSTEM.SYS00.ZCRESRL -LIB $SYSTEM.SYS00.ZCRTLSRL
Additional DLLs might need to be linked in, depending on the routines your
program uses.
The pTAL compiler and the OSS
c89 utility simplify the compiling and linking
processes. The same files are used as in the previous example, but the
c89 utility
replaces the Guardian environment CCOMP and LD commands, as shown in the
following sequence of OSS commands:
gtacl -p "ptal / in ptalsrc, out $s.#test / ptalobj"
c89 csrc /G/MYDISK/MYVOL/ptalobj -o myexec
2. In this example, the EpTAL compiler compiles the pTAL source file EPTALSRC and
generates the object file EPTALOBJ. Then the native C compiler compiles the C
source file ECSRC and generates the object file ECOBJ. Finally the ELD utility
links the EPTALOBJ and ECOBJ files with the CRE and C run-time library DLLs
and C run-time library object file and produces the executable file EMYEXEC:
EPTAL / IN EPTALSRC, OUT $S.#TEST / EPTALOBJ
CCOMP / IN ECSRC, OUT $S.#TEST / ECOBJ
ELD $SYSTEM.SYSTEM.CCPLMAIN EPTALOBJ ECOBJ -O EMYEXEC &
-LIB $SYSTEM.SYS00.ZCREDLL -LIB $SYSTEM.SYS00.ZCRTLDLL
Additional DLLs might need to be linked in, depending on the routines your
program uses.
The EpTAL compiler and the OSS
c89 utility simplify the compiling and linking
processes. The same files are used as in the previous example, but the
c89 utility