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

Libraries and Utility Routines
HP COBOL Manual for TNS/E Programs520347-003
13-13
Specifying a DLL
OSS Environment: Compile and Link in One Step
Compile the program that uses the DLL with these options:
-Wcall_shared
-L
-l
The result is a loadfile.
The command in Example 13-12 compiles the source file main.cob and links the
resulting object file with the DLL named mydll, creating the loadfile main.exe.
OSS Environment: Compile and Link in Two Steps
1. Compile the program that uses the DLL with these options:
-Wcall_shared
-c
The result is a linkfile.
2. Link the linkfile, using the eld utility with these eld options:
-L (which is similar to the ecobol option -L)
-l or -lib (which is similar to the ecobol option -l)
-optional_lib -l ZCOBDLL -l ZCREDLL, which links your file with the
SRLs named ZCOBSRL and ZCRESRL
For more information about the eld options -l or -lib, see the eld Manual.
In Example 13-13, the first command compiles the source file main.cob, specifying
the DLL named mydll and creating the linkable object file main.o. The second
command links main.o with mydll and the DLLs named ZCOBDLL and ZCREDLL,
creating the loadfile main.exe.
Note. Do not use -c.
Example 13-12. Specifying a DLL When the Compiler Calls the Linker (OSS)
ecobol main.cob -Wcall_shared -Wcobol="CONSULT MYDLL" -L /usr/xxx/yyy
-l mydll -o main.exe
Example 13-13. Specifying a DLL When You Compile and Then Link (OSS)
ecobol main.cob -Wcall_shared -Wcobol="CONSULT MYDLL" -c
eld main.o -call_shared -L /usr/xxx/yyy -l mydll -optional_lib
-l ZCOBDLL -l ZCREDLL -o main.exe