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 mentioned in the Section called Installation on Unix Systems using ns_install 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 shared libraries:

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 27 contains the list of all possible error codes. The Fortran77 subroutines take an extra output integer argument (passed by reference) at the beginning of the calling sequence that contains the error code after completion of the call. The reference manuals for C and Fortran77 are in Chapter 25 and Chapter 26.

The basic concepts here are the same as the ones discussed 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.