Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Please also see the [release notes](https://github.com/JuliaIO/HDF5.jl/releases)
* Refactor Dataspaces (#1104)
* Convert filter packages into package extensions (#1160)
* Julia 1.9 is the minimum supported Julia version (#1176)
* Support HDF5 2.0

## v0.17.2
* Fix variable length strings as attributes (#1130)
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CodecBzip2 = "0.7, 0.8"
CodecLz4 = "0.4"
CodecZstd = "0.7, 0.8"
Compat = "3.1.0, 4"
HDF5_jll = "~1.10.5, ~1.12.0, ~1.14.0"
HDF5_jll = "~1.10.5, ~1.12.0, ~1.14.0, ~2.0.0"
MPI = "0.20"
MPIPreferences = "0.1.7"
Preferences = "1.3"
Expand Down
12 changes: 9 additions & 3 deletions gen/api_defs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@
@bind h5d_iterate(buf::Ptr{Cvoid}, type_id::hid_t, space_id::hid_t, operator::Ptr{Cvoid}, operator_data::Any)::herr_t "Error iterating dataset"
@bind h5d_open2(loc_id::hid_t, pathname::Cstring, dapl_id::hid_t)::hid_t string("Error opening dataset ", h5i_get_name(loc_id), "/", pathname)
@bind h5d_read(dataset_id::hid_t, mem_type_id::hid_t, mem_space_id::hid_t, file_space_id::hid_t, xfer_plist_id::hid_t, buf::Ptr{Cvoid})::herr_t string("Error reading dataset ", h5i_get_name(dataset_id))
@bind h5d_read_chunk(dset::hid_t, dxpl_id::hid_t, offset::Ptr{hsize_t}, filters::Ptr{UInt32}, buf::Ptr{Cvoid})::herr_t "Error reading chunk"
# The function was renamed to H5Dread_chunk1 in v2.0
@bind h5d_read_chunk(dset::hid_t, dxpl_id::hid_t, offset::Ptr{hsize_t}, filters::Ptr{UInt32}, buf::Ptr{Cvoid})::herr_t "Error reading chunk" (nothing, v"2.0")
@bind h5d_read_chunk1(dset::hid_t, dxpl_id::hid_t, offset::Ptr{hsize_t}, filters::Ptr{UInt32}, buf::Ptr{Cvoid})::herr_t "Error reading chunk" (v"2.0", nothing)
@bind h5d_refresh(dataset_id::hid_t)::herr_t "Error refreshing dataset"
@bind h5d_scatter(op::Ptr{Cvoid}, op_data::Any, type_id::hid_t, dst_space_id::hid_t, dst_buf::Ptr{Cvoid})::herr_t "Error scattering to dataset"
@bind h5d_set_extent(dataset_id::hid_t, new_dims::Ptr{hsize_t})::herr_t "Error extending dataset dimensions"
Expand Down Expand Up @@ -276,7 +278,9 @@
@bind h5p_get_elink_prefix(plist_id::hid_t, prefix::Ptr{Cchar}, size::Csize_t)::Cssize_t "Error in h5p_get_elink_prefix (not annotated)"
@bind h5p_get_est_link_info(plist_id::hid_t, est_num_entries::Ptr{Cuint}, est_name_len::Ptr{Cuint})::herr_t "Error in h5p_get_est_link_info (not annotated)"
@bind h5p_get_evict_on_close(fapl_id::hid_t, evict_on_close::Ptr{hbool_t})::herr_t "Error in h5p_get_evict_on_close (not annotated)"
@bind h5p_get_external(plist::hid_t, idx::Cuint, name_size::Csize_t, name::Ptr{Cuchar}, offset::Ptr{off_t}, size::Ptr{hsize_t})::herr_t "Error getting external file properties"
# Argument type changed for Windows in v2.0
@bind h5p_get_external(plist::hid_t, idx::Cuint, name_size::Csize_t, name::Ptr{Cuchar}, offset::Ptr{off_t}, size::Ptr{hsize_t})::herr_t "Error getting external file properties" (nothing, v"2.0")
@bind h5p_get_external(plist::hid_t, idx::Cuint, name_size::Csize_t, name::Ptr{Cuchar}, offset::Ptr{H5Doff_t}, size::Ptr{hsize_t})::herr_t "Error getting external file properties" (v"2.0", nothing)
@bind h5p_get_external_count(plist::hid_t)::Cint "Error getting external count"
@bind h5p_get_family_offset(fapl_id::hid_t, offset::Ptr{hsize_t})::herr_t "Error in h5p_get_family_offset (not annotated)"
@bind h5p_get_fapl_core(fapl_id::hid_t, increment::Ptr{Csize_t}, backing_store::Ptr{hbool_t})::herr_t "Error in h5p_get_fapl_core (not annotated)"
Expand Down Expand Up @@ -372,7 +376,9 @@
@bind h5p_set_elink_prefix(plist_id::hid_t, prefix::Cstring)::herr_t "Error in h5p_set_elink_prefix (not annotated)"
@bind h5p_set_est_link_info(plist_id::hid_t, est_num_entries::Cuint, est_name_len::Cuint)::herr_t "Error in h5p_set_est_link_info (not annotated)"
@bind h5p_set_evict_on_close(fapl_id::hid_t, evict_on_close::hbool_t)::herr_t "Error in h5p_set_evict_on_close (not annotated)"
@bind h5p_set_external(plist_id::hid_t, name::Cstring, offset::off_t, size::hsize_t)::herr_t "Error setting external property"
# Argument type changed for Windows in v2.0
@bind h5p_set_external(plist_id::hid_t, name::Cstring, offset::off_t, size::hsize_t)::herr_t "Error setting external property" (nothing, v"2.0")
@bind h5p_set_external(plist_id::hid_t, name::Cstring, offset::H5Doff_t, size::hsize_t)::herr_t "Error setting external property" (v"2.0", nothing)
@bind h5p_set_family_offset(fapl_id::hid_t, offset::hsize_t)::herr_t "Error in h5p_set_family_offset (not annotated)"
@bind h5p_set_fapl_core(fapl_id::hid_t, increment::Csize_t, backing_store::hbool_t)::herr_t "Error in h5p_set_fapl_core (not annotated)"
@bind h5p_set_fapl_family(fapl_id::hid_t, memb_size::hsize_t, memb_fapl_id::hid_t)::herr_t "Error in h5p_set_fapl_family (not annotated)"
Expand Down
2 changes: 1 addition & 1 deletion gen/gen_wrappers.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generate ../src/api/functions.jl
# Run `julia --project=.. gen_wrappers.jl`` to execute this script
# Run `julia --project=.. gen_wrappers.jl` to execute this script

const group_url_dict = Dict{String,String}([
func_urls[1] => func_urls[2] for
Expand Down
139 changes: 100 additions & 39 deletions src/api/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -801,20 +801,40 @@ function h5d_read(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_pli
return nothing
end

"""
h5d_read_chunk(dset::hid_t, dxpl_id::hid_t, offset::Ptr{hsize_t}, filters::Ptr{UInt32}, buf::Ptr{Cvoid})
@static if _libhdf5_build_ver < v"2.0"
@doc """
h5d_read_chunk(dset::hid_t, dxpl_id::hid_t, offset::Ptr{hsize_t}, filters::Ptr{UInt32}, buf::Ptr{Cvoid})

See `libhdf5` documentation for [`H5Dread_chunk`](https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/documentation/doxygen/group___h5_d.html#gac1092a63b718ec949d6539590a914b60).
"""
function h5d_read_chunk(dset, dxpl_id, offset, filters, buf)
lock(liblock)
var"#status#" = try
ccall((:H5Dread_chunk, libhdf5), herr_t, (hid_t, hid_t, Ptr{hsize_t}, Ptr{UInt32}, Ptr{Cvoid}), dset, dxpl_id, offset, filters, buf)
finally
unlock(liblock)
end
var"#status#" < herr_t(0) && @h5error("Error reading chunk")
return nothing
See `libhdf5` documentation for [`H5Dread_chunk`](https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/documentation/doxygen/group___h5_d.html#gac1092a63b718ec949d6539590a914b60).
"""
function h5d_read_chunk(dset, dxpl_id, offset, filters, buf)
lock(liblock)
var"#status#" = try
ccall((:H5Dread_chunk, libhdf5), herr_t, (hid_t, hid_t, Ptr{hsize_t}, Ptr{UInt32}, Ptr{Cvoid}), dset, dxpl_id, offset, filters, buf)
finally
unlock(liblock)
end
var"#status#" < herr_t(0) && @h5error("Error reading chunk")
return nothing
end
end

@static if v"2.0" ≤ _libhdf5_build_ver
@doc """
h5d_read_chunk(dset::hid_t, dxpl_id::hid_t, offset::Ptr{hsize_t}, filters::Ptr{UInt32}, buf::Ptr{Cvoid})

See `libhdf5` documentation for [`H5Dread_chunk1`](https://docs.hdfgroup.org/hdf5/v1_14/).
"""
function h5d_read_chunk(dset, dxpl_id, offset, filters, buf)
lock(liblock)
var"#status#" = try
ccall((:H5Dread_chunk1, libhdf5), herr_t, (hid_t, hid_t, Ptr{hsize_t}, Ptr{UInt32}, Ptr{Cvoid}), dset, dxpl_id, offset, filters, buf)
finally
unlock(liblock)
end
var"#status#" < herr_t(0) && @h5error("Error reading chunk")
return nothing
end
end

"""
Expand Down Expand Up @@ -3279,20 +3299,40 @@ function h5p_get_evict_on_close(fapl_id, evict_on_close)
return nothing
end

"""
h5p_get_external(plist::hid_t, idx::Cuint, name_size::Csize_t, name::Ptr{Cuchar}, offset::Ptr{off_t}, size::Ptr{hsize_t})
@static if _libhdf5_build_ver < v"2.0"
@doc """
h5p_get_external(plist::hid_t, idx::Cuint, name_size::Csize_t, name::Ptr{Cuchar}, offset::Ptr{off_t}, size::Ptr{hsize_t})

See `libhdf5` documentation for [`H5Pget_external`](https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/documentation/doxygen/group___d_c_p_l.html#ga78253b80b6c86faf7ff0db135146521d).
"""
function h5p_get_external(plist, idx, name_size, name, offset, size)
lock(liblock)
var"#status#" = try
ccall((:H5Pget_external, libhdf5), herr_t, (hid_t, Cuint, Csize_t, Ptr{Cuchar}, Ptr{off_t}, Ptr{hsize_t}), plist, idx, name_size, name, offset, size)
finally
unlock(liblock)
end
var"#status#" < herr_t(0) && @h5error("Error getting external file properties")
return nothing
See `libhdf5` documentation for [`H5Pget_external`](https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/documentation/doxygen/group___d_c_p_l.html#ga78253b80b6c86faf7ff0db135146521d).
"""
function h5p_get_external(plist, idx, name_size, name, offset, size)
lock(liblock)
var"#status#" = try
ccall((:H5Pget_external, libhdf5), herr_t, (hid_t, Cuint, Csize_t, Ptr{Cuchar}, Ptr{off_t}, Ptr{hsize_t}), plist, idx, name_size, name, offset, size)
finally
unlock(liblock)
end
var"#status#" < herr_t(0) && @h5error("Error getting external file properties")
return nothing
end
end

@static if v"2.0" ≤ _libhdf5_build_ver
@doc """
h5p_get_external(plist::hid_t, idx::Cuint, name_size::Csize_t, name::Ptr{Cuchar}, offset::Ptr{H5Doff_t}, size::Ptr{hsize_t})

See `libhdf5` documentation for [`H5Pget_external`](https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/documentation/doxygen/group___d_c_p_l.html#ga78253b80b6c86faf7ff0db135146521d).
"""
function h5p_get_external(plist, idx, name_size, name, offset, size)
lock(liblock)
var"#status#" = try
ccall((:H5Pget_external, libhdf5), herr_t, (hid_t, Cuint, Csize_t, Ptr{Cuchar}, Ptr{H5Doff_t}, Ptr{hsize_t}), plist, idx, name_size, name, offset, size)
finally
unlock(liblock)
end
var"#status#" < herr_t(0) && @h5error("Error getting external file properties")
return nothing
end
end

"""
Expand Down Expand Up @@ -4783,20 +4823,40 @@ function h5p_set_evict_on_close(fapl_id, evict_on_close)
return nothing
end

"""
h5p_set_external(plist_id::hid_t, name::Cstring, offset::off_t, size::hsize_t)
@static if _libhdf5_build_ver < v"2.0"
@doc """
h5p_set_external(plist_id::hid_t, name::Cstring, offset::off_t, size::hsize_t)

See `libhdf5` documentation for [`H5Pset_external`](https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/documentation/doxygen/group___d_c_p_l.html#ga85ff7c9c827fa524041cd58c199b77b8).
"""
function h5p_set_external(plist_id, name, offset, size)
lock(liblock)
var"#status#" = try
ccall((:H5Pset_external, libhdf5), herr_t, (hid_t, Cstring, off_t, hsize_t), plist_id, name, offset, size)
finally
unlock(liblock)
end
var"#status#" < herr_t(0) && @h5error("Error setting external property")
return nothing
See `libhdf5` documentation for [`H5Pset_external`](https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/documentation/doxygen/group___d_c_p_l.html#ga85ff7c9c827fa524041cd58c199b77b8).
"""
function h5p_set_external(plist_id, name, offset, size)
lock(liblock)
var"#status#" = try
ccall((:H5Pset_external, libhdf5), herr_t, (hid_t, Cstring, off_t, hsize_t), plist_id, name, offset, size)
finally
unlock(liblock)
end
var"#status#" < herr_t(0) && @h5error("Error setting external property")
return nothing
end
end

@static if v"2.0" ≤ _libhdf5_build_ver
@doc """
h5p_set_external(plist_id::hid_t, name::Cstring, offset::H5Doff_t, size::hsize_t)

See `libhdf5` documentation for [`H5Pset_external`](https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_6/documentation/doxygen/group___d_c_p_l.html#ga85ff7c9c827fa524041cd58c199b77b8).
"""
function h5p_set_external(plist_id, name, offset, size)
lock(liblock)
var"#status#" = try
ccall((:H5Pset_external, libhdf5), herr_t, (hid_t, Cstring, H5Doff_t, hsize_t), plist_id, name, offset, size)
finally
unlock(liblock)
end
var"#status#" < herr_t(0) && @h5error("Error setting external property")
return nothing
end
end

"""
Expand Down Expand Up @@ -5462,6 +5522,7 @@ See `libhdf5` documentation for [`H5Pset_obj_track_times`](https://support.hdfgr
"""
function h5p_set_obj_track_times(plist_id, track_times)
lock(liblock)
@show :h5p_set_obj_track_times track_times
var"#status#" = try
ccall((:H5Pset_obj_track_times, libhdf5), herr_t, (hid_t, UInt8), plist_id, track_times)
finally
Expand Down
2 changes: 1 addition & 1 deletion src/api/helpers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# so the methods here handle making the appropriate `Ref`s and return them (as tuples).

const H5F_LIBVER_LATEST = if _libhdf5_build_ver >= v"1.15"
H5F_LIBVER_V116
H5F_LIBVER_V200
elseif _libhdf5_build_ver >= v"1.14"
H5F_LIBVER_V114
elseif _libhdf5_build_ver >= v"1.12"
Expand Down
4 changes: 3 additions & 1 deletion src/api/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const htri_t = Cint # pseudo-boolean (negative if error)
else
const off_t = Int64
end
# Introduced in HDF5 v2.0
const H5Doff_t = Int64

const H5Z_filter_t = Cint

Expand Down Expand Up @@ -317,7 +319,7 @@ const H5F_ACC_SWMR_READ = 0x0040
H5F_LIBVER_V110 = 2
H5F_LIBVER_V112 = 3
H5F_LIBVER_V114 = 4
H5F_LIBVER_V116 = 5
H5F_LIBVER_V200 = 5
H5F_LIBVER_NBOUNDS = 6
end
# H5F_LIBVER_LATEST defined in helpers.jl
Expand Down
4 changes: 2 additions & 2 deletions src/properties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ end
libver_bound_to_enum(val::Integer) = val
libver_bound_to_enum(val::API.H5F_libver_t) = val
function libver_bound_to_enum(val::VersionNumber)
val >= v"1.15" ? API.H5F_LIBVER_V116 :
val >= v"1.15" ? API.H5F_LIBVER_V200 :
val >= v"1.14" ? API.H5F_LIBVER_V114 :
val >= v"1.12" ? API.H5F_LIBVER_V112 :
val >= v"1.10" ? API.H5F_LIBVER_V110 :
Expand All @@ -720,7 +720,7 @@ function libver_bound_from_enum(enum::API.H5F_libver_t)
enum == API.H5F_LIBVER_V110 ? v"1.10" :
enum == API.H5F_LIBVER_V112 ? v"1.12" :
enum == API.H5F_LIBVER_V114 ? v"1.14" :
enum == API.H5F_LIBVER_V116 ? v"1.16" :
enum == API.H5F_LIBVER_V200 ? v"2.0" :
error("Unknown libver_bound value $enum")
end
libver_bound_from_enum(enum) = libver_bound_from_enum(API.H5F_libver_t(enum))
Expand Down
11 changes: 10 additions & 1 deletion test/plain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,16 @@ end
h5open(fn2, "w") do f
f["x", obj_track_times=false] = [1, 2, 3]
end
@test open(crc32c, fn1) == open(crc32c, fn2)
if HDF5.API.h5_get_libversion() < v"2.0.0"
@test open(crc32c, fn1) == open(crc32c, fn2)
else
# @eschnett 2025-11-26: The generated files differ in the 4
# bytes starting at offset 0x36. In the case I examined these
# values were 0x69272bef and 0x69272bf0 for the first and
# second file, respectively, and these are clearly time stamps
# for the OHDR header.
@test_broken open(crc32c, fn1) == open(crc32c, fn2)
end
rm(fn1)
rm(fn2)
end # testset plain
Expand Down
Loading