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))
,一切工作正常。
是否可以在類型定義中定義數組維以便告知編譯器,哪些是函數返回值的大小?