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

Libraries and Utility Routines
HP COBOL Manual for TNS/E Programs520347-003
13-14
Specifying a DLL
PC Environment: Compile and Link in One Step
Compile the program that uses the DLL with these ecobol flags:
-Wcall_shared
-Wcobol with the argument “CONSULT MYDLL
-L, where directory is the name of the directory of libraries
-l, where library is the name of the DLL
The result is a loadfile.
The command in Example 13-14 compiles the source file main.cob and links the
resulting object file with the DLLs named ZCOBDLL and ZCREDLL and the DLL
named mydll, creating the loadfile main.exe. MYDLL is in dll-location. (An
example of dll-location is C:\xxx\yyy.)
PC Environment: Compile and Link in Two Steps
1. Compile the program that uses the DLL with these options:
-Wcall_shared
-c
-Wcobol, with the argument “CONSULT MYDLL”
The result is a linkfile.
2. Link the linkfile, using the eld utility with these eld options:
-l or -lib (which is similar to the ecobol option -l), where library is the
name of the DLL
-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.
Note. Do not use -c.
Example 13-14. Specifying a DLL When the Compiler Calls the Linker (PC)
ecobol main.cob -Wcall_shared -Wcobol="CONSULT MYDLL" -L dll-location
-l mydll
-optional_lib -L lib-directory -l ZCOBDLL -l ZCREDLL
-o main.exe