Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Linking with BINDER

&pagelevel(4)&pagelevel

BINDER enables object modules and LLMs to be linked into an LLM and stored as a type-L element in a PLAM library. BINDER is described in detail in the “BINDER” manual [14].

Note that modules generated in the language modes C++ V3, C++ 2017 or C++ 2020 cannot be linked with a direct call to BINDER. These modules can only be linked with the compiler statement BIND (see also section “Restriction on linking C++ programs”).

Control statements for BINDER (selection)

Steueranweisungen für den BINDER (Auswahl)

/START-BINDER ————————————————————————————————————————————————————  (1)

//START-LLM-CREATION INT-NAME= name ———————————————————————————————  (2)

//INCLUDE-MODULES -

//    MOD-CONTAINER=*LIB(LIB= bibliothek ,ELEM={ mainmod / *ALL } —————  (3)

[//INCLUDE-MODULES MOD-CONTAINER=*LIB(LIB=..., ELEM=...)] ————————  (4)

[//INCLUDE-MODULES -

//    MOD-CONTAINER=*LIB(LIB=$.SYSLNK.CRTE.POSIX,ELEM=*ALL)] —————  (5)

[//RESOLVE-BY-AUTOLINK LIB=..., [SYMBOL-NAME= externverweis ]] ———————  (6)

[//RESOLVE-BY-AUTOLINK LIB=

  {([$.SYSLNK.CRTE.CFCPP,$.SYSLNK.CRTE.CPP,]$.SYSLNK.CRTE) /

   ([$.SYSLNK.CRTE.CFCPP,$.SYSLNK.CRTE.CPP,]$.SYSLNK.CRTE.PARTIAL-BIND)]}(7)

[//MODIFY-SYMBOL-VISIBILITY ..., VISIBLE=*NO] ————————————————————  (8)

//SAVE-LLM MOD-CONTAINER=*LIB(LIB= bibliothek , ELEM= element ) ————————  (9)

//END ———————————————————————————————————————————————————————————— (10)

(1)

BINDER is invoked.

(2)

This statement generates a new LLM with the internal name name in the work area. The generated LLM is saved with the SAVE-LLM statement (see 9) as a type-L element in a PLAM library.

(3)

mainmod is the name of the LLM that contains the main function.library is the name of the PLAM library in which the object modules are stored. If *ALL is specified, all the modules from the specified input source are linked.

(4)

Further INCLUDE-MODULE statements can be used to link in additional modules from various libraries.

(5)

The library SYSLNK.CRTE.POSIX must always be linked if POSIX library functions are used. Since this “linkage option” library must be linked with precedence before the C runtime system, the INCLUDE-MODULES statement should always be used for linkage.

(6)

The RESOLVE-BY-AUTOLINK statements inform BINDER of the external references (=module names) and the corresponding libraries (or only the libraries) that are to be searched with the autolink mechanism for external references that are still unresolved. RESOLVE-BY-AUTOLINK statements for user-defined libraries and modules must always be specified before those for runtime libraries (see 7).

(7)

The respective CRTE runtime libraries to be linked are specified in a list.

All modules of the C runtime system that are required by the program are linked in permanently with a RESOLVE on the SYSLNK.CRTE library.

The RESOLVE on the library SYSLNK.CRTE.PARTIAL-BIND links in a connection module instead of the C runtime system. All external references to the C runtime system are satisfied from this module. The C runtime system itself is loaded dynamically at runtime. The fully linked module requires far less disk storage space than when statically linking C runtime modules from the library SYSLNK.CRTE. Furthermore, the program executes faster.

If no RESOLVE-BY-AUTOLINK statement is specified, the external references to the runtime system remain unresolved. The runtime modules are then dynamically linked and loaded at runtime (see section “Dynamic linking and loading with DBL”).

(8)

The MODIFY-SYMBOL-VISIBILITY statement can be used to mask external symbols for subsequent linkage runs. The symbols remain visible by default. See also “Masking symbols”.

(9)

This statement stores the current LLM generated with START-LLM-CREATION as a type-L element in a PLAM library.

(10)

The END statement terminates the BINDER run.

In the INCLUDE-MODULES and RESOLVE-BY-AUTOLINK statements, LIB=*BLS-LINK may also be specified instead of the library name (LIB=library). In this case, the libraries to be searched must be assigned with the link name BLSLIBnn (00 ≤ nn ≤ 99). This is done with the ADD-FILE-LINK command before BINDER is called. For example:

/ADD-FILE-LINK LINK-NAME=BLSLIB01,FILE-NAME=PLAM.USER1
/ADD-FILE-LINK LINK-NAME=BLSLIB02,FILE-NAME=PLAM.USER2

If all external references have been resolved, any LLM generated with BINDER can be loaded and started with DBL without assigning alternative libraries as follows:

START-EXECUTABLE-PROGRAM *LIBRARY-ELEMENT(LIB= library ,ELEM= modul )

Masking symbols

In contrast to TSOSLNK, symbols (CSECTs, ENTRYs) are not masked by default when linking with BINDER and thus remain visible for subsequent linkage runs with BINDER or DBL.

This affects dynamic linking with DBL and can, among other things, have the following consequences:
If a PLAM library contains individual modules generated by the compiler as well as LLMs with a linked-in runtime system, then external references to the runtime system will be resolved from any prelinked module and not from the runtime library when the individual modules are linked dynamically. This results in several “DUPLICATES” warnings from DBL. Due to the autolink mechanism, the library in which the individual module resides is searched first, before the runtime libraries assigned with the link name BLSLIBnn.

To ensure that external references are always resolved from the current runtime library at link time rather than some arbitrary module,

  • the individual modules and prelinked modules must be maintained in different libraries,

  • or the symbols must be masked with the MODIFY-SYMBOL-VISIBILITY statement when linking with BINDER.