COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
2. Link the linkfiles into a single loadfile, 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.
• -shared, which links the linkfiles into a single loadfile that is a DLL
• -optional_lib -l ZCOBDLL -l ZCREDLL, which links your file with the DLLs named
ZCOBDLL and ZCREDLL
In Example 169, the first four commands compile four source files (LIB1, LIB2, LIB3, and LIB4),
creating four linkable object files (LIB1O, LIB2O, LIB3O, and LIB4O). The last command links the
four linkable object files with the DLLs named ZCOBDLL and ZCREDLL, creating the DLL named
MYDLL.
Example 169 Building a DLL From Multiple Source Files (Guardian)
ECOBOL /IN LIB1/ LIB1O;SHARED
ECOBOL /IN LIB2/ LIB2O;SHARED
ECOBOL /IN LIB3/ LIB3O;SHARED
ECOBOL /IN LIB4/ LIB4O;SHARED
ELD LIB1O LIB2O LIB3O LIB4O -shared -export_all -optional_lib
-l ZCOBDLL -l ZCREDLL -o MYDLL
OSS Environment
1. Compile each source file with these options:
• -Wshared
• -c
The result of each compilation is a linkfile.
2. Link the linkfiles into a single loadfile, 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.
• -shared, which links the linkfiles into a single loadfile that is a DLL
• -optional_lib -l ZCOBDLL -l ZCREDLL, which links your file with the SRLs named
ZCOBDLL and ZCREDLL
In Example 170, 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 SRLs named ZCOBDLL and
ZCREDLL, creating a DLL named mydll.
Dynamic-Link Libraries (DLLs) 605










