Previous Topic Next topic Print topic


Compiled File Types

Before you can run or debug your program 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 or from the .int file that you have already tested. 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.

Intermediate code
Intermediate code files are usually for testing and debugging. The Compiler creates the intermediate code file during its first phase, when it checks the program syntax. The Compiler also creates a dictionary file, which is used by the debugger. Intermediate code files compile quickly.

Intermediate code files have the extension .int.

.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.

To compile to .int files, your project must be set to compile to INT/GNT output type. In the Debug configuration INT/GNT projects compile to .int code by default. In Release configuration, they produce .gnt code. You can disable .gnt on the COBOL tab of your project properties for the Release configuration.

You can change the build settings of individual COBOL programs in your project to compile these to either .int or .gnt:

  1. In Solution Explorer, right-click the COBOL program whose properties you want to change and click Properties.
  2. Click the COBOL tab in the file properties, and set the Compile to .gnt to either No or Yes.
    Note: In Debug configuration, all files are set to produce .int code by default. In Release configuration, the build is set to produce .gnt code. You can change the settings in either the file or the project properties.
  3. Click OK.
Generated code

The Compiler creates the generated code, on request, during its second phase. Generated code is slower to compile than intermediate code but the resulting code runs faster.

Use generated code files for testing and debugging. As generated code runs faster than intermediate code, it can be useful in debugging for large programs, or for debugging programs where the distance between breakpoints is large, for example.

Generated code files have the extension .gnt.

.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.

To compile generated code files (.gnt), your project must be set to compile to INT/GNT output type. By default, in the Debug configuration, this project type is set to produce .int code. In Release configuration, it is set to produce .gnt code. You can enable .gnt on the COBOL tab of your project properties for the Debug configuration.

  1. Navigate to your project's properties - click Project > MyProject Properties.
  2. Click the COBOL tab.
  3. Check Compile to .gnt and save your changes.

You can change the build settings of individual COBOL programs in your project to compile these to either .int or .gnt:

  1. In Solution Explorer, right-click the COBOL program whose properties you want to change and click Properties.
  2. Click the COBOL tab in the file properties, and set the Compile to .gnt to either No or Yes.
    Note: In Debug configuration, all files are set to produce .int code by default. In Release configuration, the build is set to produce .gnt code. You can change the settings in either the file or the project properties.
  3. Click OK.
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 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 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 but differs from .int and .gnt files, where each file corresponds to a single COBOL program.

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 simplifies 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 are 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
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:

  1. Navigate to your project's properties - click Project > MyProject Properties.
  2. Click the Application tab.

    The Output type for your project must be set to INT/GNT.

  3. 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.
Previous Topic Next topic Print topic