COBOL Manual for TNS and TNS/R Programs

Libraries and Utility Routines
HP COBOL Manual for TNS and TNS/R Programs522555-006
13-20
Specifying a DLL
2. Link the linkfile, using the ld utility with these ld options:
-L (which is similar to the nmcobol option -L)
-l or -lib (which is similar to the nmcobol option -l)
-optional_lib -l ZCOBSRL -l ZCRESRL, which links your file with the
SRLs named ZCOBSRL and ZCRESRL
For more information about the ld options -l or -lib, see the ld Manual.
In Example 13-11, the first command compiles the source file MAIN, specifying the
DLL named MYDLL and creating the linkable object file MAINO. The second command
links MAINO with MYDLL and the SRLs named ZCOBSRL and ZCRESRL, creating a
loadfile named MYPROG.
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.
Example 13-11. Specifying a DLL When You Compile and Then Link (Guardian)
NMCOBOL /IN MAIN/ MAINO; CALL-SHARED; CONSULT MYDLL
LD MAINO -CALL_SHARED -L $VOL.SUBVOL -l MYDLL -optional_lib
-l ZCOBSRL -l ZCRESRL -O MYPROG
Note. Do not use -c.
Example 13-12. Specifying a DLL When the Compiler Calls the Linker (OSS)
nmcobol main.cob -Wcall_shared -Wcobol="CONSULT MYDLL" -L /usr/xxx/yyy
-l mydll -o main.exe