Skip to content

Commit

Permalink
examples: more complex submodule dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
skosukhin committed May 3, 2024
1 parent bbe43ec commit 7ff6ce8
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 21 deletions.
6 changes: 5 additions & 1 deletion src/modules/mo_test_submodule.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ end subroutine print_hello_subroutine
module function print_hello_function()
integer :: print_hello_function
end function print_hello_function

module function print_hello_function2()
integer :: print_hello_function2
end function print_hello_function2
end interface

contains
subroutine print_hello()
print *, "Hello from submodule test (parent module)."
print *, "Hello from submodule test (ancestor module)."
end subroutine print_hello
end module mo_test_submodule
9 changes: 0 additions & 9 deletions src/modules/submo_submo_test_submodule.f90

This file was deleted.

10 changes: 0 additions & 10 deletions src/modules/submo_test_submodule.f90

This file was deleted.

4 changes: 3 additions & 1 deletion src/program/main.f90
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ program main
use mo_test_submodule, only: &
& print_test_submodule_parent => print_hello, &
& print_test_submodule_subroutine => print_hello_subroutine, &
& print_test_submodule_function => print_hello_function
& print_test_submodule_function => print_hello_function, &
& print_test_submodule_function2 => print_hello_function2
use mo_threaded_hello, only: print_threaded_hello => print_hello
use mo_delayed, only: print_delayed_hello => print_hello
use mo_cmake_based, only: print_cmake_based_hello => print_hello
Expand Down Expand Up @@ -89,6 +90,7 @@ program main
call print_test_submodule_parent()
call print_test_submodule_subroutine()
retval = print_test_submodule_function()
retval = print_test_submodule_function2()

print *, "Running threaded bundled library..."
retval = print_threaded_hello()
Expand Down
9 changes: 9 additions & 0 deletions src/submodules/smo_smo_test_submodule.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
submodule (mo_test_submodule:smo_test_submodule) smo_smo_test_submodule
implicit none
contains
module function print_hello_function()
integer :: print_hello_function
print_hello_function = res
print *, "Hello from submodule test (submodule of submodule)."
end function print_hello_function
end submodule smo_smo_test_submodule
10 changes: 10 additions & 0 deletions src/submodules/smo_test_submodule.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
submodule (mo_test_submodule) smo_test_submodule
implicit none

integer, parameter :: res = 0

contains
module subroutine print_hello_subroutine()
print *, "Hello from submodule test (parentless submodule)."
end subroutine print_hello_subroutine
end submodule smo_test_submodule
8 changes: 8 additions & 0 deletions src/submodules/smo_test_submodule2.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
submodule (mo_test_submodule) smo_test_submodule2
implicit none
contains
integer module function print_hello_function2()
print_hello_function2 = 0
print *, "Hello from submodule test (parentless submodule 2)."
end function print_hello_function2
end submodule smo_test_submodule2

0 comments on commit 7ff6ce8

Please sign in to comment.