您好,使用ISO_C_Binding,是不是还得设置一下呀?我用的VS2010 Fortran2011,试了一下论坛中的小程序,结果出错
Program voi0d
use ISO_C_BINDING
implicit none
external :: ss
interface
subroutine print_a(s,a) bind(C,name='print_a_')
import
type(C_FUNPTR) , value :: s
type(C_PTR) , value :: a
end subroutine print_a
end interface
integer , target :: a = 256
call print_a( c_funloc(ss) , c_loc(a) )
print * , a
End Program voi0d
!************************************
! 需要传递的子程序如下:
!************************************
subroutine ss(a) Bind( c )
implicit none
integer a
a = a + 1
print *,'a=',a
end subroutine ss
D:\Personal\Desktop\tupian1
D:\Personal\Desktop\tupian2