Relink Applications

Note: The following applies on Windows and for native COBOL only.

Micro Focus supports the compatibility of callable objects (such as .int, .gnt which are loaded or called by a standalone executable) built with one version of Visual COBOL but deployed and executed on a newer version of Visual COBOL on the same platform, unless explicitly specified in the release notes.

However, when the callable objects are built into a standalone executable, the compatibility of the executable or of a .dll file with newer releases of Visual COBOL depends on the associated Microsoft C runtime.

If the two releases of Visual COBOL share a common C runtime, the standalone executable or the .dll is compatible with the newer release. However, if the two releases use different C runtime, then the executable or the .dll is not fully compatible when executed with the newer release.

In such situations, you should produce a new executable or a .dll that supports the newer release of the product. To do this you typically need to recompile the application from the sources.

Starting with release 4.0, you can configure Visual COBOL to check whether applications created with older releases must be relinked. If the application uses an older version of the C runtime, Visual COBOL can automatically relink the existing executable or .dll to the new version of the C runtime without the need to recompile the application first. You need the original object code (.obj) for this.

Enable the automatic relink functionality

By default , the relink functionality is disabled in Visual COBOL. In order to enable it:

  1. In Visual Studio, click Tools > Options > Micro Focus > Projects.
  2. Enable the checkbox for Check whether projects need to be relinked.
  3. Click OK.

Relink projects inside Visual Studio

In order to relink any projects created with an earlier release of Visual COBOL:

  1. Ensure you have the Visual Studio solution and the object code (.obj) for your application.
  2. Open the solution in the latest release of Visual COBOL.

    If the project contains older C libraries, Visual Studio displays an information bar suggesting that you can relink the projects.

  3. Click Relink projects.

    Visual Studio automatically links the objects to the newer C runtime libraries.

Relink projects at the command line

You can use the command line to relink a project (but not a solution) created with an earlier release of Visual COBOL. This will relink the executable or the .dll with the latest C runtime libraries.

  1. Start a Visual COBOL command prompt.
  2. Navigate to the folder that contains your project.
  3. Execute the following command:
    msbuild /Property:Relink=true [<project name>]