codekingpro/portable-devtools
114k
1 module coddity
2 use iso_c_binding, only: c_double, c_int, c_int64_t
3 implicit none
4 contains
5 subroutine c_add(a, b, c) bind(c, name="c_add")
6 real(c_double), intent(in) :: a, b
7 real(c_double), intent(out) :: c
8 c = a + b
9 end subroutine c_add
10 ! gh-9693
11 function wat(x, y) result(z) bind(c)
12 integer(c_int), intent(in) :: x, y
13 integer(c_int) :: z
14
15 z = x + 7
16 end function wat
17 ! gh-25207
18 subroutine c_add_int64(a, b, c) bind(c)
19 integer(c_int64_t), intent(in) :: a, b
20 integer(c_int64_t), intent(out) :: c
21 c = a + b
22 end subroutine c_add_int64
23 ! gh-25207
24 subroutine add_arr(A, B, C)
25 integer(c_int64_t), intent(in) :: A(3)
26 integer(c_int64_t), intent(in) :: B(3)
27 integer(c_int64_t), intent(out) :: C(3)
28 integer :: j
29
30 do j = 1, 3
31 C(j) = A(j)+B(j)
32 end do
33 end subroutine
34 end module coddity
35 