0
在编写库来读取图像值时,存在以下问题: 我定义了一个名为realimage
的新类型。在这个类型中引用一个函数,作为结果返回一个数组。要从类型定义中调用的数组值函数
module typedefinition
implicit none
type realimage
integer :: byteorder = 0
contains
procedure :: initialize => initializereal
procedure :: pxvalues => pxvaluesreal ! Array valued function
end type realimage
contains
function pxvaluesreal(this, x, y) result(val)
implicit none
type(realimage) this
real val(5)
integer :: x, y
...
end function
end module
编译与gfortran模块并调用函数image1%pxvalues(x,y)
,我总是得到以下错误消息:
main.f95: In function ‘testtype’:
main.f95:15: internal compiler error
如果我直接调用该函数在主程序(pxvaluesreal(image1,x,y))
,一切工作正常。
是否可以在类型定义中定义数组维以便告知编译器,哪些是函数返回值的大小?