I have a module that does this (among other things):
module tryit
implicit none
character(len=:),allocatable,dimension(:),save :: subtitle
contains
subroutine setSubTitle(lines)
character(len=*),dimension(:) :: lines
subtitle=lines
end subroutine setSubTitle
subroutine getSubTitle ( lines )
character(len=*),dimension(:),intent(out) :: lines
if (allocated(subtitle)) lines = subtitle
end subroutine getSubTitle
end
This works fine. But I had a reason to consider making the length of subtitle a constant, e.g.:
character(len=60),allocatable,dimension(:),save :: subtitle
This crashes on the first reference to subtitle *after* the assignment. Should this work?
In each case I tried the actual argument passed as lines was a static array, e.g.:
character(len=220),save :: buffer(20)
call setSubTitles(buffer(3:9))