COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
Example 173 Specifying a DLL When You Compile and Then Link (Guardian)
ECOBOL /IN MAIN/ MAINO; CALL-SHARED; CONSULT MYDLL
ELD MAINO -CALL_SHARED -L $VOL.SUBVOL -l MYDLL -optional_lib
-l ZCOBDLL -l ZCREDLL -O MYPROG
OSS Environment: Compile and Link in One Step
Compile the program that uses the DLL with these options:
• -Wcall_shared
• -L
• -l
NOTE: Do not use -c.
The result is a loadfile.
The command in Example 174 compiles the source file main.cob and links the resulting object
file with the DLL named mydll, creating the loadfile main.exe.
Example 174 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
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 175, 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.
Example 175 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
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”
608 Libraries and Utility Routines










