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
$NETSOLVE_ROOT/lib/$NETSOLVE_ARCH/libnetsolve.a : the C library
$NETSOLVE_ROOT/lib/$NETSOLVE_ARCH/libfnetsolve.a : the Fortran77 library
Before linking to one of these libraries, the user must include the appropriate header file in his program:
$NETSOLVE_ROOT/include/netsolve.h in C,
$NETSOLVE_ROOT/include/fnetsolve.h in Fortran77.
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.