Hello, Thank you very much. This is exactly what I was looking for, except that I was looking for a directly overloaded Fortran version. This is close enough :-)
Regards, Pierre On Thu, Jan 21, 2016 at 03:06:16PM +0000, Scot Breitenfeld wrote: > On Jan 21, 2016, at 6:55 AM, Pierre de Buyl > <[email protected]> wrote: > > Hi, > I am developing a Fortran code that uses HDF5. The Fortran API > datatypes listed > at https://www.hdfgroup.org/HDF5/doc/RM/PredefDTypes.html indicate that > the > Fortran interface supports only H5T_NATIVE_INTEGER. I remember that > someone > hinted at using convert or some other trick to store longer integers > but (i) the > list is hard to search for, as there is no search facility and (ii) I > am looking > for a standard solution, if possible. > I need to store a variable that is "bind(c)" and of type "c_int64_t", > as defined > in the iso_c_binding. This variable cannot be stored in the HDF5 file > as the > h5dwrite_f routine is only overloaded to accept "integer" (i.e. the > default > kind). > If I am mistaken, I would be glad to know how to overcome the problem. > > You can read/write any fortran type which has a C representation if you > use the F2003 interface for > H5Dread and H5Dwrite. > Take a look at the examples with the _F03 in the name (they use the > F2003 interfaces): > https://www.hdfgroup.org/HDF5/examples/api18-fortran.html > But you would also be interested in rwdset_fortran2003.f90 at > https://www.hdfgroup.org/HDF5/examples/f-src.html > Scot > > Else, I would have a more general question: is it planned for HDF5 to > support > routinely the iso_c_binding kinds? A priori the overloading could be > limited to > the typical c_int8_t, c_int16_t, c_int32_t and c_int64_t (if available > on the > platform) and resolved at compile type, even if the user chose to > declare the > variables as "integer", "integer(kind=some_other_kind)". > In my situation, I would like to store a PRNG seed and thus need an > exact > mapping of the c_int64_t type on disk. > Thanks for any info. > Regards, > Pierre _______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org Twitter: https://twitter.com/hdf5
