- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
module m implicit none private type, public :: t private integer, allocatable :: m_i(:) contains private procedure, pass(this), public :: set => set_t procedure, pass(this), public :: get => get_t end type t interface module subroutine set_t(this, iarr) class(t), intent(inout) :: this integer, intent(in) :: iarr(:) end subroutine set_t module function get_t(this) result(msg) class(t), intent(in) :: this !.. function result character(len=size(this%m_i)) :: msg end function get_t end interface end module m
submodule(m) sm contains module subroutine set_t(this, iarr) class(t), intent(inout) :: this integer, intent(in) :: iarr(:) this%m_i = iarr return end subroutine set_t module function get_t(this) result(msg) class(t), intent(in) :: this !.. function result character(len=size(this%m_i)) :: msg integer :: i forall (i=1:size(this%m_i)) msg(i:i) = achar(this%m_i(i)) return end function get_t end submodule sm
program p use m, only : t type(t) :: foo integer, parameter :: im(78) = [ 72, 101, 108, 108, 111, 44, & 32, 87, 111, 114, 108, 100, & 33, 32, 32, 83, 117, 98, & 109, 111, 100, 117, 108, 101, & 115, 32, 97, 114, 101, 32, & 104, 101, 114, 101, 33, 10, & 84, 104, 105, 115, 32, 99, & 104, 97, 110, 103, 101, 115, & 32, 101, 118, 101, 114, 121, & 116, 104, 105, 110, 103, 33, & 10, 84, 104, 97, 110, 107, & 32, 121, 111, 117, 44, 32, & 73, 110, 116, 101, 108, 33 ] call foo%set(im) print *, foo%get() stop end program p
Hello, World! Submodules are here! This changes everything! Thank you, Intel! Press any key to continue . . .
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What's exactly the problem or the question?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think he's happy (at least, that's how I'm reading it! :-) )
--Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The four-line pseudo program output in #1 explains the post. Finding true love reciprocated can induce what Dr. Spock would call "irrational responses". See his recent post, https://software.intel.com/en-us/forums/topic/391387 .
For a description of sub-modules, please see http://fortranwiki.org/fortran/show/Submodules .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The program output in the original post is not pseudo, it's actual! Using 16.0 beta. I attached the zip file in case anyone else wanted to review it with Visual Studio 2012/2013.
Dr Fortran has urged patience previously on this front and this shows good things do come to those who wait! Kudos to Intel Fortran team for this major achievement.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page