예. 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
문자열을 사용하면 문제가 생깁니다.
포트란과 C 서명을 붙여 넣을 수 있습니까 –