This manual page also documents the usage of the F77_FUNC macros to aid C programmers importing/exporting their fortran/C code to C/Fortran resp.
C
C: Test program for NEMO’s footran interface
C+
C in=???\n Required (dummy) filename
C n=1000\n Test integer value
C pi=3.1415\n Test real value
C e=2.3\n Another test value
C text=hello world\n Test string
C VERSION=1.1\n 24-may-92 PJT
C-
C
SUBROUTINE nemomain
C
.......
with the following commands
% ftoc test.f > test_main.c
% gfortran -c test.f test_main.c -L$NEMOLIB -lnemo
a non-graphics program can be compiled. It is assumed, that the fortran callable getparam(3NEMO) has also been added to the NEMO library.
In fortran:
DOUBLE PRECISION FUNCTION FUNCF(X)
DOUBLE PRECISION X, FUNCC
IF (X.LT.1.0d0) THEN
FUNCF = SQRT(X)
ELSE
FUNCF = FUNCC(1.0d0/X)
ENDIF
END
and in C: #define funcc F77_FUNC(funcc,FUNCC)
#define funcf F77_FUNC(funcf,FUNCF)
extern double funcf(double *);
double funcc(double * xp) {
double x = *xp;
if (x < 1.0)
return sqrt(x);
else {
x = 1.0/x;
return funcf(&x);
}
}
See Alsonm(1) AuthorPeter Teuben Update History
xx-jun-92 V1.0 Created PJT
25-May-92 V1.1 added c: to signal usage line PJT
20-jan-98 more doc
7-jan-00 V2.0 changed to use F77_FUNC; machine -> options PJT
30-apr-21 align man and bin PJT