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