COBOL Manual for TNS and TNS/R Programs

Libraries and Utility Routines
HP COBOL Manual for TNS and TNS/R Programs522555-006
13-13
Building a DLL From a Single Source File
2. Link the linkfile, using the ld 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 ZCOBSRL -l ZCRESRL, which links your file with the
SRLs named ZCOBSRL and ZCRESRL
The resulting loadfile is a DLL.
In Example 13-2, the first command compiles the source file LIB1, creating the linkable
object file LIB1O. The second command links LIB1O with the SRLs named ZCOBSRL
and ZCRESRL, creating a DLL named MYDLL.
OSS Environment: One-Step Method
Compile the source file with these options:
-Wshared
-Wld 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-3
compiles the source file lib1.cob and links the
resulting object file, creating a DLL named mydll.
Example 13-2. Building a DLL From a Single Source File in Two Steps (Guardian)
NMCOBOL /IN LIB1/ LIB1O; SHARED
LD LIB1O -SHARED -EXPORT_ALL -optional_lib -l ZCOBSRL -l ZCRESRL
-o MYDLL
Note. Do not use -c.
Example 13-3. Building a DLL From a Single Source File in One Step (OSS)
nmcobol lib1.cob -Wshared -Wld="-export_all