COBOL Manual for TNS/E Programs (H06.03+)
Libraries and Utility Routines
HP COBOL Manual for TNS/E Programs—520347-003
13-11
Specifying a DLL
•
-optional_lib followed by:
°
-L lib-directory -lcob, which links your file with the DLL named
ZCOBDLL
°
-obey lib-directory\libc.obey, which links your file with the DLL
named ZCREDLL
lib-directory is the name of the directory of libraries.
In Example 13-9, the first four commands compile four source files (lib1.cob,
lib2.cob, lib3.cob, and lib4.cob), creating four linkable object files (lib1.o,
lib2.o, lib3.o, and lib4.o). The last command links the four linkable object files
with the DLLs named ZCOBDLL and ZCREDLL, creating a DLL named mydll.
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 (default)
•
CONSULT with the name of the DLL as an object-name (see CONSULT and
NOCONSULT)
Example 13-9. Building a DLL From Multiple Source Files (PC)
ecobol lib1.cob -Wshared -c
ecobol lib2.cob -Wshared -c
ecobol lib3.cob -Wshared -c
ecobol lib4.cob -Wshared -c
eld lib1.o lib2.o lib3.o lib4.o -shared -export_all
-optional_lib -L lib-directory -lcob
-obey lib-directory\libc.obey -o mydll










