Adam, I believe the problem is the second argument in the H5Tset_size call. It's of size_t, but you are casting -1 as unsigned int, which is not the expected value for a variable-length string in 64-bit.
Best, G. From: Hdf-forum [mailto:[email protected]] On Behalf Of Adam Edwards Sent: Monday, November 9, 2015 7:10 AM To: HDF Users Discussion List Subject: Re: [Hdf-forum] H5Dread Hi Gerd, Thanks for replying. The header info for this dataset is: GROUP "/" { GROUP "Metadata" { DATASET "datetime" { DATATYPE H5T_STRING { STRSIZE H5T_VARIABLE; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; } DATASPACE SCALAR } } Many thanks Adam From: Hdf-forum [mailto:[email protected]] On Behalf Of Gerd Heber Sent: 09 November 2015 12:53 To: HDF Users Discussion List <[email protected]<mailto:[email protected]>> Subject: Re: [Hdf-forum] H5Dread Adam, how are you? Can you send us the h5dump output from the dataset you are trying to read? A small sample file would be great, but just the header information should be sufficient (h5dump -H). Thanks, G. From: Hdf-forum [mailto:[email protected]] On Behalf Of Adam Edwards Sent: Friday, November 6, 2015 3:25 AM To: [email protected]<mailto:[email protected]> Subject: [Hdf-forum] H5Dread Hello, I am working with ILNumerics on use of their HDF5 wrapper in an x64 c#.NET application. I have encountered an issue when trying to read a vlen string: Basic code is: datasetId = H5D.H5Dopen2 ( ds.File.ID, ds.Path, Constants.H5P_DEFAULT ); // prepare vlen data type (string) memType = H5T.H5Tcopy ( H5T.H5T_C_S1 ); int err = H5T.H5Tset_size ( memType, unchecked ( ( uint ) -1 ) ); if ( err != 0 ) { throw new ArgumentException ( "Unable to determine data size" ); } ILSize size = ds.Size; // buffer for reading pointer(s) to the string(s) IntPtr [] buffer = new IntPtr [size.NumberOfElements]; GCHandle h = GCHandle.Alloc ( buffer, GCHandleType.Pinned ); err = H5D.H5Dread ( datasetId, memType, H5S.ALL, H5S.ALL, Constants.H5P_DEFAULT, h.AddrOfPinnedObject () ); h.Free (); // now the _pointers_ to the strings should be in the buffer. We need to copy / convert them to new strings on the managed heap. ILArray<string> ret = ILMath.array<string> ( "", ds.Size ); int i = 0; foreach ( var element in buffer ) { ret [i++] = Marshal.PtrToStringAnsi ( element ); } return ret; When run on x86 it performs as expected, but on x64 we get a -1 error from the Dread call with the following std output: HDF5-DIAG: Error detected in HDF5 (1.8.9) thread 0: #000: C:\autotest\HDF518ReleaseCMake\src\H5Dio.c line 174 in H5Dread(): can't read data major: Dataset minor: Read failed #001: C:\autotest\HDF518ReleaseCMake\src\H5Dio.c line 337 in H5D_read(): unable to set up type info major: Dataset minor: Unable to initialize object #002: C:\autotest\HDF518ReleaseCMake\src\H5Dio.c line 838 in H5D_typeinfo_init(): unable to convert between src and dest datatype major: Dataset minor: Feature is unsupported #003: C:\autotest\HDF518ReleaseCMake\src\H5T.c line 4481 in H5T_path_find(): no appropriate function for conversion path major: Datatype minor: Unable to initialize object The only difference between x86 and x64 I could find was the IntPtr size (4 & 8 respectively). The current build version being used is 1.8.9. Has this issue been encountered before, and if so was it fixed in a later build? Many Thanks for any guidance you can offer. Adam Edwards | AP Sensing UK Phone: +49-7031-309-6645 | Fax: +49-7031-309-6611 | www.apsensing.com<http://www.apsensing.com/> | Facebook<https://www.facebook.com/APSensing> | LinkedIn<http://www.linkedin.com/company/ap-sensing> Place of Registration: Boeblingen | Commercial Register Stuttgart - HRB 724880 | VAT ID: DE256976415 | Managing Directors: Clemens Pohl, Gerd Koffmane
_______________________________________________ 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
