#include "stdio.h"
extern void fortranfunction();
extern float aa[3];
int main()
{
printf("hello world from C\n");
fortranfunction();
printf("%f %f %f \n", aa[0], aa[1], aa[2]);
return 0;
}
module myModule
use,intrinsic :: iso_c_binding
implicit none
real(C_FLOAT), bind(C,name ="aa") :: aa(3)
contains
subroutine fortranFunction() bind(C,name = "fortranfunction" )
print *,"hello world from Fortran 90"
aa(1)=1.0;
aa(2)=2.0;
aa(3)=3.0;
end subroutine
end module
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |