The C source program is contained in the cataloged file HELLO. The compiler generates an LLM and places it in the library PLAM.TEST. This module is then linked by different methods:
Variant 1: with the BIND statement of the compiler
Variant 2: with BINDER
Variant 3: with DBL
Source program file HELLO
#include <stdio.h> int main(void) { printf("Hello, I am a C program\n"); return 0; }
The source program was written using EDT and saved in a file named HELLO.
Runtime listing for compilation, linkage and execution
(IN) indicates user inputs (OUT) indicates system program messages (IN) /START-CPLUS-COMPILER —————————————————————————————————————————— (1) (OUT) % BLS0523 ELEMENT ’SDFCC’, VERSION ’04.0B02’, TYPE ’L’ FROM LIBRARY ’:P401:$TSOS.SYSLNK.CPP.040’ IN PROCESS (OUT) % BLS0524 LLM ’SDFCC’, VERSION ’04.0B02’ OF ’2023-04-02 13:40:11’ LOADED (OUT) % BLS0551 COPYRIGHT (C) 2023 Fujitsu Technology Solutions GmbH. ALL RIGHTS RESERVED (OUT) % CDR9992 : BEGIN C/C++ VERSION 04.0B02 (IN) //MODIFY-SOURCE-PROP LANGUAGE=*C ——————————————————————————————— (2) (IN) //COMPILE SOURCE=HELLO,MODULE-OUTPUT=*LIB-ELEM(LIB=PLAM.TEST) —— (3) (OUT) % CDR9907 : NOTES: 0 WARNINGS: 0 ERRORS: 0 FATALS: 0 (OUT) % CDR9937 : MODULES GENERATED, CPU TIME USED = 0.0030 SEC
Variant 1: Linking with the BIND statement
(IN) //MOD-BIND-PROP INCLUDE=*LIB(LIB=PLAM.TEST,ELEM=HELLO),- //RUNTIME-LANG=*C,STDLIB=*STATIC ——————————————————————————————— (4) (IN) //BIND OUTPUT=*LIB(LIB=PLAM.TEST1,ELEM=HELLO) —————————————————— (5) (OUT) % BND3102 SOME WEAK EXTERNS UNRESOLVED (OUT) % BND1501 LLM FORMAT: '1' (OUT) % BND1101 BINDER NORMALLY TERMINATED. SEVERITY CLASS: 'UNRESOLVED EXTERNAL' (IN) //END ——————————————————————————————————————————————————————————— (6) (OUT) % CDR9936 END; SUMMARY: NOTES: 0 WARNINGS: 0 ERRORS: 0 FATALS: 0 (OUT) % CCM0998 CPU TIME USED: 1.9967 SECONDS
Variant 2: Linking with BINDER
(IN) /START-BINDER —————————————————————————————————————————————————— (7) (OUT) % BND0500 BINDER VERSION 'V02.7A12' STARTED (IN) //START-LLM-CREATION INT-NAME=XY (IN) //INCLUDE-MODULES *LIB(LIB=PLAM.TEST,ELEM=HELLO) (IN) //RESOLVE-BY-AUTOLINK LIB=$.SYSLNK.CRTE (IN) //SAVE-LLM LIB=PLAM.TEST1,ELEM=HELLO,MAP=*NO (OUT) % BND3102 SOME WEAK EXTERNS UNRESOLVED (OUT) % BND1501 LLM FORMAT: '1' (IN) //END (OUT) % BND1101 BINDER NORMALLY TERMINATED. SEVERITY CLASS: 'UNRESOLVED EXTERNAL'
Variant 3: Linking, loading and starting with DBL
(IN) /ADD-FILE-LINK LINK-NAME=BLSLIB01,FILE-NAME=$.SYSLNK.CRTE —————— (8) (IN) /START-EXECUTABLE-PROGRAM FROM-FILE=*LIB-ELEM(LIBRARY=PLAM.TEST,- /ELEMENT-OR-SYMBOL=HELLO),DBL-PARAMETERS=*PARAM(- /RESOLUTION=*PARAM(ALTERNATE-LIBRARIES=*BLSLIB##)) (OUT) % BLS0524 LLM 'HELLO', VERSION ' ' OF '2020-04-02 13:33:56' LOADED (OUT) Hello, I am a C program (OUT) % CCM0998 CPU TIME USED: 0.0021 SECONDS
Starting programs linked with variants 1 and 2
(IN) /START-EXECUTABLE-PROGRAM FROM-FILE=*LIB-ELEM(LIBRARY=PLAM.TEST1,- /ELEMENT-OR-SYMBOL=HELLO) —————————————————————————————————————— (9) (OUT) % BLS0524 LLM 'XY', VERSION ' ' OF '2020-04-02 13:33:50' LOADED (OUT) Hello, I am a C program (OUT) % CCM0998 CPU TIME USED: 0.0028 SECONDS
(1) | The compiler is started. |
(2) | The MODIFY-SOURCE-PROPERTIES statement is used to set the language mode C (the default setting is language mode C++). |
(3) | The COMPILE statement is issued with selected options to begin compilation. The SOURCE option specifies the name of the source program to be compiled, and the MODULE-OUTPUT option specifies a PLAM library as the output destination. The name of the object module to be generated is derived from that of the source program (HELLO). |
(4) | The MODIFY-BIND-PROPERTIES statement specifies the modules to be linked and other conditions for the subsequent linkage run with the BIND statement of the compiler. The INCLUDE option (which corresponds to the BINDER statement INCLUDE-MODULES) specifies the LLM HELLO, which was generated earlier and placed in the library PLAM.TEST. The RUNTIME-LANGUAGE option specifies that the program to be linked is a C program (C++ is the default). Due to this option, all additional modules of the C runtime system which are required for C programs are automatically linked with the autolink mechanism. The *STATIC entry in the STDLIB option instructs the compiler to load the C runtime system from the library $.SYSLNK.CRTE instead of the library $.SYSLNK.CRTE.PARTIAL-BIND (the default). |
(5) | The BIND statement is issued to start the linkage run. The OUTPUT option (which corresponds to the BINDER statement SAVE-LLM) causes the fully-linked LLM to be stored under the name HELLO as an element of type L in the PLAM library PLAM.TEST1. The BINDER message “SOME WEAK EXTERNS UNRESOLVED” refers to the ILCS module IT0INITS. This module contains WEAK-EXTERN references to all languages potentially required for ILCS. In this example, only the C language is involved, so the other references remain unresolved. |
(6) | The END statement terminates the compiler run. |
(7) | The HELLO module that was generated at compilation in the PLAM library PLAM.TEST is linked with BINDER. |
(8) | The HELLO module, which was generated at compilation and placed in the PLAM library PLAM.TEST, is dynamically linked, loaded and started with DBL. |
(9) | The finished program HELLO, which was fully linked with the BIND statement of the compiler (see variant 1) and with BINDER (see variant 2) and placed in the library PLAM.TEST1, is loaded and started. The entry ALT-LIB=*BLSLIB## (see variant 3), which is required for dynamic linking with DBL, is not needed in this case. |