COBOL Manual for TNS and TNS/R Programs

Libraries and Utility Routines
HP COBOL Manual for TNS and TNS/R Programs522555-006
13-19
Specifying a DLL
Specifying a DLL
To use an existing DLL, you must specify it to both the compiler and the linker. You can
do this in either one step or two.
Topics:
Guardian Environment: Compile and Link in One Step
Guardian Environment: Compile and Link in Two Steps
OSS Environment: Compile and Link in One Step
OSS Environment: Compile and Link in Two Steps
PC Environment: Compile and Link in One Step
PC Environment: Compile and Link in Two Steps
Guardian Environment: Compile and Link in One Step
Compile the program that uses the DLL with these directives:
CALL-SHARED
CONSULT with the name of the DLL as an object-name (see CONSULT and
NOCONSULT)
LD with these options:
°
-L (which is similar to the nmcobol option -L)
°
-l or -lib (which is similar to the nmcobol option -l)
For more information about the ld options -l or -lib, see the ld Manual.
The result is a loadfile.
The command in Example 13-10 compiles the source file MAIN and links the resulting
object file with the DLL named MYDLL, creating a loadfile named MAINO.
Guardian Environment: Compile and Link in Two Steps
1. Compile the program that uses the DLL with these directives:
CALL-SHARED
CONSULT with the name of the DLL as an object-name (see CONSULT
and NOCONSULT)
The result is a linkfile.
Example 13-10. Specifying a DLL When the Compiler Calls the Linker (Guardian)
NMCOBOL /IN MAIN/ MAINO; CALL-SHARED; CONSULT MYDLL; RUNNABLE;&
&LD(-L $VOL.SUBVOL -l MYDLL)