Before your program can be run or debugged, it must be in a form that can be executed. The Compiler can produce the following types of files:
- Executable code
- You produce executable code by compiling and linking in one step.
An executable file has
a filename extension of
.exe.
To produce executable code, you need to modify the Output Type setting in the project properties.
- Object code
-
You can compile to object code from the source code file. The object code file is not executable. It requires linking with the run-time system to produce an executable file.
By default, object code files have the extension
.obj.
Object code files must be linked to create
.exe or
.dll files.
- Dynamic Link Libraries
- Dynamic Link Libraries are dynamically loaded at run time when required, that is, when referenced as a main entry point (for example, by run
) or by the COBOL CALL syntax. When all the entry points in a Dynamic Link Library
have been canceled then the file is unloaded, releasing any memory used.
This behavior is
different to linked shared libraries and system executables, which are always loaded at process start-up, whether they are used or not. Further, the code and memory used by shared libraries and system executables are only unloaded when the process terminates.
A Dynamic Link Library can contain more than one COBOL program and can also contain other language programs, such as C and C++. Dynamic Link Libraries can also be linked with third party object files or shared libraries. This behavior is similar to system executables and shared libraries.
A Dynamic Link Library
has a filename extension of
.dll.
Bundling intermediate or generated code files
You can bundle
.int files and
.gnt files in Micro Focus library files. The advantages of this are:
- It can simplify the packaging of files for users, as it reduces the number of files to be shipped.
- When your program calls a subprogram stored in a library file, the library file and all the programs loaded in it, is loaded into memory. This can make program execution faster.
A library file has the file extension
.lbr.
For example, given the following programs in our application:
Figure 1. Programs in application
ProgC and ProgD could be compiled as generated code files, and then placed in a library file,
mylib.lbr. When ProgA calls ProgC,
mylib.lbr would be loaded into memory, also loading
progc.gnt and
progd.gnt. You would need to ship
proga.gnt,
progb.gnt, and
mylib.lbr, as well as a trigger program.
To package the
.int and
.gnt files into an
.lbr file, set the following properties:
- Navigate to your project's properties - click
Project >
MyProject Properties.
- Click the
Application tab.
The
Output type for your project must be set to
INT/GNT.
- Check
Package as .lbr and save your changes.
Next time you build your project, the project compiles to an .lbr.
Important: You cannot debug a project that compiles to .int or .gnt code if it is set to package the output files as an .lbr file. Before you can debug such projects you need to disable the setting
Package as .lbr on the
Application page in your project's properties.