Help us improve by taking our short survey: https://www.hdfgroup.org/website-survey/

| HDF5 Last Updated on 2026-07-28 The HDF5 Field Guide

Loading...
Searching...
No Matches
Fortran Library (H5) Interface

## Detailed Description

See also
  H5, C-API
  HDF5 Library and Programming Model, User Guide

## Modules
module | h5lib
| This module provides fortran specific helper functions for the HDF library.

## Functions/Subroutines
subroutine, public | h5check_version_f (majnum, minnum, relnum, error)
| Verifies that library versions are consistent.
subroutine, public | h5close_f (error)
| Closes HDF5 Fortran interface.
subroutine, public | h5dont_atexit_f (error)
| Instructs library not to install atexit cleanup routine.
subroutine, public | h5garbage_collect_f (error)
| Garbage collects on all free-lists of all types.
subroutine, public | h5get_free_list_sizes_f (reg_size, arr_size, blk_size, fac_size, error)
| Gets the current size of the free lists used to manage memory.
subroutine, public | h5get_libversion_f (majnum, minnum, relnum, error)
| Returns the HDF5 LIbrary release number.
integer function, dimension(1:8), public | h5gmtime (stdtime_t)
| Convert time_t structure (C) to Fortran DATE AND TIME storage format.
integer(hid_t) function, public | h5kind_to_type (ikind, flag)
| Converts the KIND to the correct HDF type.
integer(size_t) function, public | h5offsetof (start, end)
| Computes the offset in memory.
subroutine, public | h5open_f (error)
| Initializes HDF5 Fortran interface.

## Variables
integer | h5_index_crt_order_f
| H5_INDEX_CRT_ORDER.
integer | h5_index_n_f
| H5_INDEX_N.
integer | h5_index_name_f
| H5_INDEX_NAME.
integer | h5_index_unknown_f
| H5_INDEX_UNKNOWN.
integer, parameter | h5_integer_kind = 0
| Used in the function h5kind_to_type().
integer | h5_iter_dec_f
| H5_ITER_DEC.
integer | h5_iter_inc_f
| H5_ITER_INC.
integer | h5_iter_n_f
| H5_ITER_N.
integer | h5_iter_native_f
| H5_ITER_NATIVE.
integer | h5_iter_unknown_f
| H5_ITER_UNKNOWN.
integer, parameter | h5_real_kind = 1
| Used in the function h5kind_to_type().
integer | h5_szip_ec_om_f
| H5_SZIP_EC_OM.
integer | h5_szip_nn_om_f
| H5_SZIP_NN_OM.
integer(haddr_t) | haddr_undef_f
| HADDR_UNDEF.

## Function/Subroutine Documentation

## ◆ h5check_version_f()

subroutine, public h5check_version_f | ( | integer, intent(in) | majnum,
|  | integer, intent(in) | minnum,
|  | integer, intent(in) | relnum,
|  | integer, intent(out) | error )

Verifies that library versions are consistent.

Parameters

  majnum | Major version of the library.
  minnum | Minor version of the library.
  relnum | Release version of the library.
  error | Returns 0 if successful and -1 if it fails.

See C API: H5check_version()

## ◆ h5close_f()

subroutine, public h5close_f | ( | integer, intent(out) | error | ) |

Closes HDF5 Fortran interface.

Parameters

  error | Returns 0 if successful and -1 if it fails.

## ◆ h5dont_atexit_f()

subroutine, public h5dont_atexit_f | ( | integer, intent(out) | error | ) |

Instructs library not to install atexit cleanup routine.

Parameters

  error | Returns 0 if successful and -1 if it fails.

See C API: H5dont_atexit()

## ◆ h5garbage_collect_f()

subroutine, public h5garbage_collect_f | ( | integer, intent(out) | error | ) |

Garbage collects on all free-lists of all types.

Parameters

  error | Returns 0 if successful and -1 if it fails.

See C API: H5garbage_collect()

## ◆ h5get_free_list_sizes_f()

subroutine, public h5get_free_list_sizes_f | ( | integer(c_size_t), intent(out) | reg_size,
|  | integer(c_size_t), intent(out) | arr_size,
|  | integer(c_size_t), intent(out) | blk_size,
|  | integer(c_size_t), intent(out) | fac_size,
|  | integer, intent(out) | error )

Gets the current size of the free lists used to manage memory.

Parameters

  reg_size | The current size of all "regular" free list memory used
  arr_size | The current size of all "array" free list memory used
  blk_size | The current size of all "block" free list memory used
  fac_size | The current size of all "factory" free list memory used
  error | Returns 0 if successful and -1 if it fails.

See C API: H5get_free_list_sizes()

## ◆ h5get_libversion_f()

subroutine, public h5get_libversion_f | ( | integer, intent(out) | majnum,
|  | integer, intent(out) | minnum,
|  | integer, intent(out) | relnum,
|  | integer, intent(out) | error )

Returns the HDF5 LIbrary release number.

Parameters

  majnum | Major version of the library.
  minnum | Minor version of the library.
  relnum | Release version of the library.
  error | Returns 0 if successful and -1 if it fails.

See C API: H5get_libversion()

## ◆ h5gmtime()

integer function, dimension(1:8), public h5gmtime | ( | integer(kind=time_t), intent(in) | stdtime_t | ) |

Convert time_t structure (C) to Fortran DATE AND TIME storage format.

Parameters

  stdtime_t | Object of type time_t that contains a time value

Returns
  datetime A date/time array using Fortran conventions:
  - datetime(1) = year
  - datetime(2) = month
  - datetime(3) = day
  - datetime(4) = 0 ! time is expressed as UTC (or GMT timezone)
  - datetime(5) = hour
  - datetime(6) = minute
  - datetime(7) = second
  - datetime(8) = millisecond – not available, assigned - HUGE(0)

## ◆ h5kind_to_type()

integer(hid_t) function, public h5kind_to_type | ( | integer, intent(in) | ikind,
|  | integer, intent(in) | flag )

Converts the KIND to the correct HDF type.

Parameters

  ikind | Fortran KIND parameter
  flag | Whether KIND is of type INTEGER or REAL: H5_INTEGER_KIND - integer H5_REAL_KIND - real

Returns
  h5_type Returns the type.

## ◆ h5offsetof()

integer(size_t) function, public h5offsetof | ( | type(c_ptr), intent(in), value | start,
|  | type(c_ptr), intent(in), value | end )

Computes the offset in memory.

Parameters

  start | Starting pointer address
  end | Ending pointer address

Returns
  offset Offset of a member within the derived type.

## ◆ h5open_f()

subroutine, public h5open_f | ( | integer, intent(out) | error | ) |

Initializes HDF5 Fortran interface.

Parameters

  error | Returns 0 if successful and -1 if it fails.

## Variable Documentation

## ◆ h5_index_crt_order_f

integer h5_index_crt_order_f

H5_INDEX_CRT_ORDER.

## ◆ h5_index_n_f

integer h5_index_n_f

H5_INDEX_N.

## ◆ h5_index_name_f

integer h5_index_name_f

H5_INDEX_NAME.

## ◆ h5_index_unknown_f

integer h5_index_unknown_f

H5_INDEX_UNKNOWN.

## ◆ h5_integer_kind

integer, parameter h5_integer_kind = 0

Used in the function h5kind_to_type().

## ◆ h5_iter_dec_f

integer h5_iter_dec_f

H5_ITER_DEC.

## ◆ h5_iter_inc_f

integer h5_iter_inc_f

H5_ITER_INC.

## ◆ h5_iter_n_f

integer h5_iter_n_f

H5_ITER_N.

## ◆ h5_iter_native_f

integer h5_iter_native_f

H5_ITER_NATIVE.

## ◆ h5_iter_unknown_f

integer h5_iter_unknown_f

H5_ITER_UNKNOWN.

## ◆ h5_real_kind

integer, parameter h5_real_kind = 1

Used in the function h5kind_to_type().

## ◆ h5_szip_ec_om_f

integer h5_szip_ec_om_f

H5_SZIP_EC_OM.

## ◆ h5_szip_nn_om_f

integer h5_szip_nn_om_f

H5_SZIP_NN_OM.

## ◆ haddr_undef_f

integer(haddr_t) haddr_undef_f

HADDR_UNDEF.