You must compile your program to an executable before it can be run or debugged. This topic summarizes the different types of executable file that the Micro Focus COBOL Compiler can produce. It also gives recommendations to help you choose which file format is most appropriate for your applications and summarizes how you can package files together by bundling intermediate and generate code files into Micro Focus library files.
The Compiler the supports generation of procedural COBOL code to Java .class files and also offers object-oriented extensions to the COBOL language.
An executable file has a filename extension of .exe (Windows) or no filename extension (UNIX).
To create executable code, you need either a COBOL project or a remote COBOL project. Select Project > Properties > Micro Focus > Build Configuration and create or edit a configuration, choosing a Target types option of All Executable Files or Single Executable File.
By default, object code files have the extension .obj (Windows) or .o (UNIX).
Object code files must be linked to create .exe or .dll files (Windows) or executable, callable shared object or shared library files (UNIX).
.int files are dynamically loadable, and don't need to be linked into a system executable. You can ship them to your users as executable files, but we recommend that you use .exe files and .dll files for this.
.gnt files are dynamically loadable, and don't need to be linked into a system executable. You can ship them to your users as executable files, but we recommend that you use .exe files and .dll files for this.
This behavior is similar to .int and .gnt code but 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 (Windows) or a callable shared object (UNIX) can contain more than one COBOL program and can also contain other language programs, such as C and C++. Dynamic link libraries (Windows) or callable shared objects (UNIX) can also be linked with third party object files or shared libraries. This behavior is similar to system executables and shared libraries but differs from .int and .gnt files, where each file corresponds to a single COBOL program.
A dynamic link library (Windows) has a filename extension of .dll.
A callable shared object file (UNIX) has a filename extension of .so.
This section contains general guidance and recommendations about when to use each of the different file formats.
.int files have the advantage of being portable across different hardware platforms. They have the disadvantage of not being optimized for any target architecture and will typically execute more slowly than code that has been generated for a specific platform.
.gnt files are optimized for a specific chipset. They typically execute faster than .int code. Micro Focus recommends the use of generated executables for best application performance.
.gnt files are not locked by the operating system while executing. This means that new files can be overlaid, but this is not considered good practice.
Standard executable formats, such as .dll or .exe, are also optimized for the target platform and can be digitally signed. These formats can also contain more than one program.
Micro Focus recommends the use of standard format executables.
You can bundle .int files and .gnt files in Micro Focus library files. The advantages of this are:
A library file has the file extension .lbr.
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: