File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,14 +24,14 @@ def search_hdf5lib
2424 end
2525 return lib_path if File . exist? ( lib_path )
2626
27- warn "htslib shared library '#{ name } ' not found."
27+ warn "hdf5 shared library '#{ name } ' not found."
2828 end
2929 end
3030
3131 self . lib_path = search_hdf5lib
3232end
3333
34- require_relative 'hdf5/ffi3 '
34+ require_relative 'hdf5/ffi '
3535
3636require_relative 'hdf5/file'
3737require_relative 'hdf5/group'
Original file line number Diff line number Diff line change 1+ module HDF5
2+ module FFI
3+ extend ::FFI ::Library
4+
5+ begin
6+ ffi_lib HDF5 . lib_path
7+ rescue LoadError => e
8+ raise LoadError , "#{ e } \n Could not find #{ HDF5 . lib_path } "
9+ end
10+
11+ # @!macro attach_function
12+ # @!scope class
13+ # @!method $1(${2--2})
14+ # @return [${-1}] the return value of $0
15+ def self . attach_function ( *)
16+ super
17+ rescue ::FFI ::NotFoundError => e
18+ warn e . message # if $VERBOSE
19+ end
20+
21+ def self . attach_variable ( *)
22+ super
23+ rescue ::FFI ::NotFoundError => e
24+ warn e . message # if $VERBOSE
25+ end
26+
27+ attach_function 'H5get_libversion' , %i[
28+ pointer
29+ pointer
30+ pointer
31+ ] , :int
32+
33+ major_ptr = ::FFI ::MemoryPointer . new ( :int )
34+ minor_ptr = ::FFI ::MemoryPointer . new ( :int )
35+ release_ptr = ::FFI ::MemoryPointer . new ( :int )
36+ HDF5 ::FFI . H5get_libversion ( major_ptr , minor_ptr , release_ptr )
37+
38+ raise 'HDF5 major version mismatch' if major_ptr . read_int != 1
39+
40+ case minor_ptr . read_int
41+ when 10
42+ require_relative 'ffi_10'
43+ when 14 ..Float ::INFINITY
44+ require_relative 'ffi_14'
45+ end
46+ end
47+ end
Original file line number Diff line number Diff line change 1+ # require_relative 'ffi'
2+
13module HDF5
24 module FFI
3- extend ::FFI ::Library
4-
5- begin
6- ffi_lib HDF5 . lib_path
7- rescue LoadError => e
8- raise LoadError , "#{ e } \n Could not find #{ HDF5 . lib_path } "
9- end
10-
11- # @!macro attach_function
12- # @!scope class
13- # @!method $1(${2--2})
14- # @return [${-1}] the return value of $0
15- def self . attach_function ( *)
16- super
17- rescue ::FFI ::NotFoundError => e
18- warn e . message # if $VERBOSE
19- end
20-
21- def self . attach_variable ( *)
22- super
23- rescue ::FFI ::NotFoundError => e
24- warn e . message # if $VERBOSE
25- end
5+ MiV = 10
266
277 typedef :uchar , :__u_char
288
@@ -663,11 +643,11 @@ class H5AllocStatsT < ::FFI::Struct
663643 H5AllocStatsT . ptr
664644 ] , :herr_t
665645
666- attach_function 'H5get_libversion' , %i[
667- pointer
668- pointer
669- pointer
670- ] , :herr_t
646+ # attach_function 'H5get_libversion', %i[
647+ # pointer
648+ # pointer
649+ # pointer
650+ # ], :herr_t
671651
672652 attach_function 'H5check_version' , %i[
673653 uint
You can’t perform that action at this time.
0 commit comments