我试图从fortran函数返回一个类型。这是代码。为什么不能访问该类型?
module somemodule
implicit none
! define a simple type
type sometype
integer :: someint
end type sometype
! define an interface
interface
! define a function that returns the previously defined type
type(sometype) function somefunction()
end function somefunction
end interface
contains
end module somemodule
在gfortran(4.4 & 4.5)我收到以下错误:
Error: The type for function 'somefunction' at (1) is not accessible
我编译的文件:
gfortran -c ./test.F90
我试图让类型明确公开,但该没有帮助。我打算使用某种功能的c版本,这就是为什么我把它放在界面部分。
为什么类型不可访问?