Re: Derived type in main
- From: dpb <none@xxxxxxx>
- Date: Wed, 18 Jul 2007 02:29:28 -0500
Ralf Schaa wrote:
People,
an example that does not seem to work:
Module some_module
implicit none
private
public :: some_subroutine
containsuse some_types
subroutine some_subroutine(t_test)
type(myType), intent(in) :: t_test
print*, t_test%test
end subroutine some_subroutine
end Module some_module
Module some_types
implicit none
type myType
real :: test
end type myType
end Module some_types
program mainuse some_types
use some_module, only: some_subroutine
implicit none
type( myType ) :: t_test
call some_subroutine( t_test )
end program main
I suspect the type definition must be in a module or the subroutine
'some_subroutine' must be contained in the main program (and not in
the module 'some_module').
I was just hoping that a derived type in the *main* program could be
passed like this ... or am I doing something wrong here?
Only that -- the definition of the structure must be available to the subroutine(s) where it is used as well as in the main program.
As you say, it could be at a module level or in a module of data to be USEd...
It's late but I _think_ what I munged on yours above is one way...
--
.
- References:
- Derived type in main
- From: Ralf Schaa
- Derived type in main
- Prev by Date: Re: Derived type in main
- Next by Date: fortran // concat /> fortranconcat
- Previous by thread: Re: Derived type in main
- Next by thread: Re: Derived type in main
- Index(es):
Relevant Pages
|