COBOL Manual for TNS/E Programs (H06.03+)

Libraries and Utility Routines
HP COBOL Manual for TNS/E Programs520347-003
13-7
Building a DLL From a Single Source File
-optional_lib -l ZCOBDLL -l ZCREDLL, which links your file with the
DLLs named ZCOBDLL and ZCREDLL
The resulting loadfile is a DLL.
In Example 13-4, the first command compiles the source file lib1.cob, creating the
linkable object file lib1.o. The second command links lib1.o with the DLLs named
ZCOBDLL and ZCREDLL, creating a DLL named mydll.
PC Environment: One-Step Method
Compile the source file with these options:
-Wshared
-Weld with either of these arguments:
°
-export_all, which exports all program names in the source file
°
-export program-name, which exports only the specified program name.
You must repeat this option for every program name that you want to export.
The resulting loadfile is a DLL.
The command in Example 13-5 compiles the source file lib1.cob and links the
resulting object file, creating a DLL named mydll.
PC Environment: Two-Step Method
1. Compile the source file with these options:
-Wshared
-c
The result is a linkfile.
Example 13-4. Building a DLL From a Single Source File in Two Steps (OSS)
ecobol lib1.cob -Wshared -c
eld lib1.o -shared -export_all -optional_lib -l ZCOBDLL
-l ZCREDLL -o mydll
Note. Do not use -c.
Example 13-5. Building a DLL From a Single Source File in One Step (PC)
ecobol lib1.cob -Wshared -Weld="-export_all" -o mydll