Mail Archives: cygwin/1998/07/16/23:22:54
Hi!
In the following example you can see how to call FORTRAN stuff
from a C main. Obviously you can do also the opposite.
Hope this helps.
Bye, Massimo
------------------------------- beginning ---------------------------------
------------------------------- main.c ------------------------------------
#include <stdio.h>
int main() {
int i=2;
printf("Calling fsub() with argument: i=%d\n",i);
fsub_(&i);
printf(" after fsub(): i=%d\n",i);
printf("Calling intfsub() with argument: i=%d\n",i);
printf("intfun() returns %d \n",intfun_(&i));
}
------------------------------- ffun.f ------------------------------------
integer function intfun(i)
intfun=3*i
return
end
subroutine fsub(i)
i=i*2
return
end
------------------------------- makefile -----------------------------------
O = o
F = f
C = c
X = exe
FOR = g77
CL = gcc
OBJS = main.$(O) ffun.$(O)
CO = -c
LO =
LIBS =
a.$(X) : $(OBJS) $(LIBS)
$(FOR) $(LO) $(OBJS) $(LIBS) -o a.$(X)
main.$(O) : main.$(C)
$(CL) $(CO) main.$(C)
ffun.$(O) : ffun.$(F)
$(FOR) $(CO) ffun.$(F)
------------------------------- end -----------------------------------
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -