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

Libraries and Utility Routines
HP COBOL Manual for TNS/E Programs520347-003
13-8
Building a DLL from Multiple Source Files
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 followed by:
°
-L lib-directory -lcob, which links your file with the DLL named
ZCOBDLL
°
-obey lib-directory\libc.obey, which links your file with the DLL
named ZCREDLL
lib-directory is the name of the directory of libraries.
The resulting loadfile is a DLL.
In Example 13-6, 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.
Building a DLL from Multiple Source Files
Each source file from which you build the DLL can contain one or more source
programs.
Building a DLL from multiple source files takes two steps:
1. Compile the source files.
2. Link the resulting linkfiles into a single loadfile.
Topics:
Guardian Environment
OSS Environment
PC Environment
Example 13-6. Building a DLL From a Single Source File in Two Steps (PC)
ecobol lib1.cob -Wshared -c
eld lib1.o -shared -export_all -optional_lib -L lib-directory
-lcob -obey lib-directory\libc.obey -o mydll