COBOL Manual for TNS and TNS/R Programs
Issues Related to Binding and Linking
HP COBOL Manual for TNS and TNS/R Programs—522555-006
24-9
Binding or Linking HP COBOL Programs
External references call routines in:
•
Other code blocks in the same user code space or user library space
•
Code blocks in user library space
•
The system code space
•
Code blocks in system code extension
To enable the system loader to fix up references to routines in user library space, you
must provide the name of the user library file. The three ways to do this, in order of
preference, are:
1. Designate the file in a LIBRARY directive in the compilation.
2. Designate the file in a LIB option in the RUN command.
3. Designate the file as the second file name in the first parameter (file-names ) of
a call to the NEWPROCESS routine.
If the system loader cannot resolve an external reference, it reports that there are still
unresolved externals (?EXT: name ). The process executes until it attempts to call an
unresolved external procedure, and then it calls the selected debugger (see Debugger
Selection).
The fixup operation is the reason that the first execution of a newly compiled program
is less efficient than subsequent executions. After the system loader has performed the
fixup, subsequent executions of the program do not need this operation until the
contents of the loadfile are changed or the operating environment is changed.
This run-time resolution helps to reduce object file size and compilation times. It also
reduces the likelihood that you will have to recompile an HP COBOL program when a
run-time routine that it calls is enhanced or corrected.
Binding or Linking HP COBOL Programs
A TNS HP COBOL program can be bound automatically, as part of compilation, or with
BIND, after compilation.
A native HP COBOL program can be linked automatically, as part of compilation: If you
specify the RUNNABLE or SEARCH directive when creating a non-PIC loadfile, the
NMCOBOL compiler also calls the nld utility. If you specify the RUNNABLE or
SEARCH directives when creating a PIC loadfile (CALL-SHARED) or when creating a
DLL library (SHARED), the NMCOBOL compiler also calls the ld utility. If you do not
link the program automatically, you must use the nld or ld utility to link it after
compilation.
Topics:
•
Binding or Linking Automatically
•
Binding or Linking Programs to Be Called Dynamically
•
Binding With BIND