I am trying to pass a procedure pointer to a derived-type-bound-procedure
module mymodule
use mystoremodule
implicit none
private
type, abstract, public :: mytype
contains
procedure :: parse
end type mytype
contains
subroutine parse(self,mypointer)
implicit none
! Declaring Part
class(mytype) :: self
procedure(storing),pointer, intent(in) :: mypointer
integer :: myvalue
! Executing Part
myvalue = 42
call mypointer(myvalue)
end subroutine parse
end module mymodule
where storing is defined in another module/ derived type
module mystoremodule
implicit none
type, public :: storingtype
integer :: myvalue
contains
procedure, public :: storing
end type storingtype
contains
subroutine storing(self,myvalue)
! Declaring part
class(storingtype) :: self
integer, intent(in) :: myvalue
! Executing part
self%myvalue = myvalue
end subroutine SetExcitationOrder
end module mystoremodule
I call the procedure by
call mytypeobject%parse(storingtypeobject%storing)
With that i get a compiler error
The type of the actual argument differs from the type of the dummy argument.
I found out that the error comes from the procedure pointer not passing the dummy argument to the storing procedure (i didn't define anything as nopass). In all other cases the dummy argument gets passed automatically, why not here? It's not feasible for me to declare the dummy argument, as the object which the procedure uses changes.
Are there any solutions to my problem?
type(mytype) mytypeobjectandtype(storingtype) storingtypeobjectbut confirming that would be good. - francescalus