COBOL Manual for TNS and TNS/R Programs
Libraries and Utility Routines
HP COBOL Manual for TNS and TNS/R Programs—522555-006
13-16
Building a DLL from Multiple Source Files
2. Link the resulting linkfiles into a single loadfile.
Topics:
•
Guardian Environment
•
OSS Environment
•
PC Environment
Guardian Environment
1. Compile each source file with the directive SHARED.
The result of each compilation is a linkfile.
2. Link the linkfiles into a single loadfile, 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.
•
-shared, which links the linkfiles into a single loadfile that is a DLL
•
-optional_lib -l ZCOBSRL -l ZCRESRL, which links your file with the
SRLs named ZCOBSRL and ZCRESRL
In Example 13-7, 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 SRLs named ZCOBSRL and
ZCRESRL, creating the DLL named MYDLL.
Note. Do not use the RUNNABLE directive.
Example 13-7. Building a DLL From Multiple Source Files (Guardian)
NMCOBOL /IN LIB1/ LIB1O;SHARED
NMCOBOL /IN LIB2/ LIB2O;SHARED
NMCOBOL /IN LIB3/ LIB3O;SHARED
NMCOBOL /IN LIB4/ LIB4O;SHARED
LD LIB1O LIB2O LIB3O LIB4O -shared -export_all -optional_lib
-l ZCOBSRL -l ZCRESRL -o MYDLL