H5Dwrite_f() API; what is `dims` argument for? and what should be passed?

Dear experts…

I’ve just begun learning how to user HDF5 (in FORTRAN), using a precompiled RPM package version of HDF5 library (v.1.14.6) on Fedora-42 (x86_64) boxes; it does not seem to be built with --enable-fortran2003.

I have a question on the API of h5dwrite_f___f90_version() (seems to be used as h5dwrite_f() in e.g. hdf5-1.14.6/HDF5Examples/FORTRAN/TUTR/h5_extend.f90): what is the purpose of dims argument for? and what exactly should be passed?

The reference manual states the dims argument is an "Array to hold corresponding dimension sizes of data buffer buf; dim(k) has value. of the k-th dimension of buffer buf; values are ignored if buf is a scalar. ", but in the above-mentioned example, to write the data in INTEGER, DIMENSION(1:21) :: data2 array, data_dims(1:2) = (/3,7/) is passed as its dimension, and therefore I’m confused…
(by the way, though obsoleted , "dim(k) has value. " should read "dims(k) has value " I think…))

Is it ok to pass an array which has the equal number of elements as that of the data buffer?

Thanks in advance…
Kazuyoshi

–enable-fortran2003 is obsolete, 1.14.x contains all the 2003 APIs as well when --enable-fortran is used. It is best to use the 2003 APIs with no dimension argument.

As for the example, data2 could have also been INTEGER, DIMENSION(3,7) :: data2
Just so long as the DIMENSION(1) is the total number of elements being written, it will work.