Restriction: This topic applies to Windows environments only.
If you want to link modules dynamically at run-time, you have two choices:
- You can code your calling module to check whether the called module is already available. This way you retain the option to
link modules statically sometimes. Each calling module that calls another module first tests the external reference address,
and then if it is zero, issues a LOAD for the module, saving the address in the external reference field, then a BALR to go
to the called module. With this method you must also specify the Linker directive NCAL when you build the executable program.
To do this, disable
Resolve external calls at link time (CALL) in your project properties and on the
Micro Focus > Project Settings > Assembler Compiler > Auto-link Settings tab.
With NCAL set, the linker issues warnings that external references were not resolved and stores zero in each field holding
the address of an external reference.
- You can code your calling module to link dynamically always. You simply issue a LOAD for the module you want to link to, then
a BALR to branch to it. With this method it makes no difference whether you specify the NCAL Linker directive or not.
We recommend that you also mark each module in this environment as reentrant and serially reusable, so that modules are not
deleted and reloaded for each call.
To mark a module as reentrant:
- In your project properties and on the
Micro Focus > Project Settings > Assembler Compiler tab, set
Mark module as reentrant (RENT) to
true.
To mark a module as serially reusable:
- In your project properties and on the
Micro Focus > Project Settings > Assembler Compiler > Auto-link Settings tab, set
Mark load module as serially reusable (REUS) to
true.
If you want to use static linking on a module that is normally dynamically linked, and its
END statement names a default entry point for the module, you may need to provide an
ENTRY command in the linker input file,
.LIN, to override the default entry point. This is because the Linker, emulating the mainframe binder tool, sets the entry point
for the entire executable program to the entry point named on the
END statement of the final included module.