A DLL is built using compiled source code and a module definition (.DEF) file or export (.EXP) file.
Do the followings steps to create and use a DLL:
You can use a module definition file, which is a text file that describes the names, attributes, exports, and other characteristics of a program or DLL. In it you use the EXPORTS statement to list all the subprograms in the DLL that can be called by a program or by another DLL.
If you provide a .LIB file but not a module definition file, cob2 creates the .DEF file. Otherwise, to link a DLL, you must provide to cob2 a .DEF file; cob2 will then generate an import (.IMP) file and an export (.EXP) file. An import file tells the linker where to find the DLL subprograms used by your program. An export file is a binary file that tells the linker what parts the DLL exports.
Your COBOL program can make a call to a user-defined identifier rather than to a literal DLL subprogram name. Use this type of call when the name of the target subprogram is not known until run time.
Rather than using calls that are resolved at run time, you can use COBOL CALL literal. By default, the linker resolves these calls. However, the setting of the DYNAM compiler option determines whether the linker resolves these calls:
Use cob2 to compile your source files and create a DLL. When you use cob2 to compile and link the DLL, specify the names of all the DLL source files and the name of the module definition file. The name of the first source file is used as the name of the DLL unless you use the -dll option (for example, -dll:TEST).
Example: DLL source file and related files
related concepts
CALL identifier and CALL literal
Static linking and dynamic linking
How the linker resolves references to DLLs
related tasks
Creating module definition files
related references
DYNAM