Chapter 5. C and Fortran77 Interfaces

Table of Contents
Introduction
What is the Calling Sequence?
Blocking Call
Nonblocking Call
Catching errors
Row- or column-major
Limitations of the Fortran77 interface
Built-in examples

Introduction

As previously mentioned in the section called Installation on Unix Systems in Chapter 3, the C/Fortran77 client interfaces for NetSolve are built by typing
UNIX> make C Fortran
in the directory $NETSOLVE_ROOT. This compilation produces the following two archive files:

where NETSOLVE_ROOT is the full path name to the NetSolve directory and NETSOLVE_ARCH is the architecture name generated by configure.

Before linking to one of these libraries, the user must include the appropriate header file in his program:

The Fortran77 include file is not mandatory, but increases the source program readability by allowing calling subroutines to manipulate the NetSolve error codes by variable name rather than by integer value.

The Fortran77 interface is built on top of the C interface since all of the networking underneath NetSolve is written in C. However, we chose to write the Fortran77 interface with subroutines instead of functions (for reasons of compiler compatibilities). The C functions all return a NetSolve error code equal to 0 if the call was successful or to a negative value in case of error. Chapter 24 contains the list of all possible error codes. The Fortran77 subroutines take an extra output integer argument (passed by reference) at the end of the calling sequence that contains the error code after completion of the call. The reference manuals for C and Fortran77 are in Chapter 22 and Chapter 23.

The basic concepts here are the same as the ones we have introduced in Chapter 6 for the Matlab interface, especially the ability to call NetSolve in a blocking or nonblocking fashion.

We describe the C and Fortran77 interfaces by the means of an example. In the following section we start developing the example by demonstrating how a user can obtain information about the calling sequence to a given problem.