aboutsummaryrefslogtreecommitdiff

Clp-Fortran Interface Library

Download current: zip or tar.gz

The Clp-Fortran interface library provides a simple wrapper around the COIN Linear Programming Library's C interface in a Fortran compatible manner. This interface aims to simplify the calling, eliminating much of the need to deal with C-style strings and arrays, instead providing clean Fortran equivalents.

Much of the instructions and infrastructure included in this distribution focus on configuration and use on Windows systems, though the library itself can be built on other operating systems. Several Simply Fortran projects to simplify building the library and example code are also included.

Library Overview

The Clp-Fortran interface is comprised of five Fortran source files contained within the src directory:

  • clp.f90 - Primary interface code for the library containing
  • clp_callback.f90 - Code for supporting the COIN model callbacks in a Fortran-esque style
  • clp_constants.F90 - Constants used by the interface library and the COIN Linear Programming Library itself
  • clp_interface_utilities.f90 - Code mostly directed at handling the conversion of C strings to Fortran strings and vice versa
  • clp_types.f90 - Module containing necessary derived type definitions (currently empty)

The most notable feature of this interface library is that routines that would provide arrays and strings will do so using Fortran programming paradigms rather than only providing thin wrappers returning C pointers. Arrays that are either used as input or output are Fortran-native arrays, and procedures using strings can use normal Fortran strings without requiring C-style string termination.

Using Clp on Windows

Two separate sets of intructions are provided for using Clp and this library on Windows. For users wishing to compile the COIN Linear Programming library from scratch can consult clp-bin/BUILD.md for instructions on how to build static libraries from CoinUtils and Clp source code on Windows. This process is somewhat time-consuming and requires substantially more requirements to configure a Minimalist GNU For Windows 64-bit (MinGW64) UNIX-like environment.

The instructions for working with prebuilt COIN Linear Programming libraries on Windows are contained in clp-dll/README.md, and the requirements are substantially simpler. These instructions include where to download prebuilt libraries and what files should be extracted to use this interface.

Included Projects

Four Simply Fortran projects are included in this distribution.

For Compiling the Clp-Fortran interface library:

  • libClpFortran.prj - Produces a static library for use with the static build of the COIN Linear Programming library in clp-bin
  • libClpFortran.dll.prj - Produces a DLL for use with the prebuilt COIN Linear Programming DLL library in clp-dll

Examples using the Clp-Fortran interface library:

  • clp-example.prj - Builds an example program using static libraries
  • clp-example-using-dlls.prj - Builds an example program using shared libraries

Users are encouraged to work with the example projects as a basis because they include the flags necessary to build an executable that calls the Clp-Fortran interface library.


by Jeff Armstrong (jeff@approximatrix.com)

Initial Release: 2020-10-30