Actual source code: ex1f90.F
1: !
2: !
3: module junk
4: type abc
5: integer a
6: double precision,pointer :: b(:)
7: integer c
8: end type
9: end module
11: program main
12: use junk
14: type (abc) x
16: ALLOCATE(x%b(5))
18: x%a = 1
19: x%b(1) = 11.0
20: x%c = 111
22: call c_routine(x)
24: write (6,100) x%a, x%b(1), x%c
25: 100 format("From Fortran Main:",i3," ",1pe8.2," ",i3)
27: DEALLOCATE(x%b)
29: end program
32: subroutine fortran_routine(x)
33: use junk
35: type (abc) x
37: write (6,110) x%a, x%b(1), x%c
38: 110 format("From Fortran routine called by C:",i3," ",1pe8.2," ",i3)
39: x%a = 3
40: x%b(1) = 33.0
41: x%c = 333
42: end