module memory ! This code is an example of calling a Windows API function. implicit none ! This declaration is needed so that the proper "decorations" ! will be applied to the imported symbol dll_import GlobalMemoryStatus ! Windows memory status structure type mst sequence integer :: Length = 32 integer :: MemoryLoad integer :: TotalPhys integer :: AvailPhys integer :: TotalPageFile integer :: AvailPageFile integer :: TotalVirtual integer :: AvailVirtual end type mst contains subroutine mem_stat(mem) type(mst) :: mem call GlobalMemoryStatus(mem) end subroutine mem_stat end module memory ! Driver program program memstat use memory implicit none type(mst) :: mem call mem_stat(mem) write(*,*) write(*,*) ' Current memory status:' write(*,*) write(*,*) ' Percent memory load = ', mem%MemoryLoad write(*,*) ' Total physical memory = ', mem%TotalPhys write(*,*) ' Available physical memory = ', mem%AvailPhys write(*,*) ' Total page file = ', mem%TotalPageFile write(*,*) ' Available page file = ', mem%AvailPageFile write(*,*) ' Total virtual memory = ', mem%TotalVirtual write(*,*) ' Available virtual memory = ', mem%AvailVirtual end program