Actual source code: ex1f90.F

  1: !
  2: !    "$Id: ex1f90.F,v 1.2 2000/08/23 18:38:41 balay Exp $"
  3: !
  4:       module junk
  5:       type abc
  6:       integer a
  7:       double precision,pointer :: b(:)
  8:       integer c
  9:       end type
 10:       end module

 12:       program main
 13:       use junk

 15:       type (abc) x

 17:       ALLOCATE(x%b(5))

 19:       x%a = 1
 20:       x%b(1) = 11.0
 21:       x%c = 111

 23:       call c_routine(x)

 25:       write (6,100) x%a, x%b(1), x%c
 26:  100  format("From Fortran Main:",i3," ",1pe8.2," ",i3)
 27:       end program


 30:       subroutine fortran_routine(x)
 31:       use junk

 33:       type (abc) x

 35:       write (6,110) x%a, x%b(1), x%c
 36:  110  format("From Fortran routine called by C:",i3," ",1pe8.2," ",i3)
 37:       x%a = 3
 38:       x%b(1) = 33.0
 39:       x%c = 333
 40:       end