COBOL Manual for TNS and TNS/R Programs

Libraries and Utility Routines
HP COBOL Manual for TNS and TNS/R Programs522555-006
13-11
Dynamic-Link Libraries (DLLs)
Dynamic-Link Libraries (DLLs)
A DLL is a library of shared code [PIC] that contains functions or data for other PIC
loadfiles. (For more information about PIC and DLLs, see the DLL Programmers
Guide for TNS/R Systems.)
You can put a program in a DLL if:
It is not a main program.
It does not contain embedded SQL/MP or SQL/MX statements.
It does not contain external objects (data or files that are to be shared with code
that is outside the library).
If you put an HP COBOL program in a DLL, you must export the program name when
you build the DLL; otherwise, other programs cannot call the HP COBOL program. To
export the HP COBOL program name, use either the LD directive (Guardian) or the
-Wld option (OSS and PC), with one of the linker options in Table 13-3.
Topics:
Building a DLL From a Single Source File
Building a DLL from Multiple Source Files
Specifying a DLL
Building a DLL From a Single Source File
The single source file from which you build the DLL can contain one or more source
programs.
You can build a DLL from a single source file in either one step or two: either compile
the source file and have the compiler call the linker, or compile the source file and call
the linker yourself. (For linker instructions, see the ld Manual.)
Note. This topic applies only to the NMCOBOL compiler. A TNS program uses a TNS user
library (see TNS User Library
).
Note. ASSIGN and PARAM commands for files in a DLL are ignored.
Table 13-3. Linker Options That Export Program Names
Environment
Option exports ...
All program names
in the source file Only the specified program name
Guardian LD (-export_all) LD (-export program-name )
OSS and PC -Wld="-export_all" -Wld="-export program-name "