COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
Example 163 Building a DLL From a Single Source File in One Step (Guardian)
ECOBOL /IN LIB1/ MYDLL; SHARED; RUNNABLE; &
&ELD(-export_all)
Guardian Environment: Two-Step Method
1. Compile the source file with the directive SHARED (page 568).
NOTE: Do not use the RUNNABLE directive.
The result is a linkfile.
2. Link the linkfile, using the eld utility with these options:
• Either:
◦ -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.
• -optional_lib -l ZCOBDLL -l ZCREDLL, which links your file with the SRLs named
ZCOBDLL and ZCREDLL.
The resulting loadfile is a DLL.
In Example 164, the first command compiles the source file LIB1, creating the linkable object file
LIB1O. The second command links LIB1O with the DLLs named ZCOBDLL and ZCREDLL, creating
a DLL named MYDLL.
Example 164 Building a DLL From a Single Source File in Two Steps (Guardian)
ECOBOL /IN LIB1/ LIB1O; SHARED
ELD LIB1O -SHARED -EXPORT_ALL -optional_lib -l ZCOBDLL
-l ZCREDLL -o MYDLL
OSS Environment: One-Step Method
Compile the source file with these options:
• -Wshared
NOTE: Do not use -c.
• -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 165 compiles the source file lib1.cob and links the resulting object
file, creating a DLL named mydll.
602 Libraries and Utility Routines










