Skip to content

Instantly share code, notes, and snippets.

@unterumarmung
Created March 21, 2022 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unterumarmung/eb025d23f36af73ef8b6b442a8d0dc58 to your computer and use it in GitHub Desktop.
Save unterumarmung/eb025d23f36af73ef8b6b442a8d0dc58 to your computer and use it in GitHub Desktop.
module a
implicit none
abstract interface
function foo(x)
integer, intent(in) :: x
integer :: foo
end function foo
end interface
type handle
procedure(foo), pointer, nopass :: foo1 => NULL()
procedure(foo), pointer, nopass :: foo2 => NULL()
end type handle
end module a
module b
use a
implicit none
contains
integer function bar1(foo1)
implicit none
procedure(foo) :: foo1
bar1 = 42
end function bar1
integer function bar2(h)
implicit none
type(handle) :: h
procedure(foo), pointer :: f1 => NULL()
procedure(foo), pointer :: f2 => NULL()
integer :: res
f1 => h%foo1
res = bar1(f1)
bar2 = res
end function bar2
end module b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment