Пример. если вам нужна функция, которая возвращает void, вы должны использовать подпрограмму.
function foo(input, output)
implicit none
integer :: foo
integer, intent(in) :: input
integer, intent(out) :: output
output = input + 3
foo = 0
end function
program test
implicit none
integer :: a, b, c, foo
b = 5
a = foo(b, c)
print *,a,b, c
end program
Если вы вызываете подпрограмму C, то в подписи используются ссылки.
$ cat test.f90
program test
implicit none
integer :: a, b, c, foo
b = 5
a = foo(b, c)
print *,a,b, c
end program
$ cat foo.c
#include <stdio.h>
int foo_(int *input, int *output) {
printf("I'm a C routine\n");
*output = 3 + *input;
return 0;
}
$ g95 -c test.f90
$ gcc -c foo.c
$ g95 test.o foo.o
$ ./a.out
I'm a C routine
0 5 8
если вы используете строки, все становится грязно.