Hi Andrei,

was hdf5_EXPORTS defined when compiling HDF5?

You could check the hdf5.dll if its appropriately defined for export:

$ nm hdf5.dll | grep H5T_NATIVE_DOUBLE
000000006b60ac80 B H5T_NATIVE_DOUBLE_ALIGN_g
000000006b60abf8 B H5T_NATIVE_DOUBLE_COMP_ALIGN_g
000000006b57d6c4 D H5T_NATIVE_DOUBLE_g
000000006b60ad60 B H5T_NATIVE_DOUBLE_NEG_INF_g
000000006b60ad58 B H5T_NATIVE_DOUBLE_POS_INF_g


Werner


On 15.05.2014 15:14, Андрей Парамонов wrote:
Hello ladies and gentlemen!

I'm trying to compile a minimal HDF5 example via MinGW on w32:

#include "hdf5.h"

int main()
{
hid_t file_id;
hid_t dataset_id;
hid_t attribute_id;
hid_t space_id;
hssize_t nscans, npeaks;
double minmz, maxmz;

printf("Opening MS.abf ... ");
file_id = H5Fopen("MS.abf", H5F_ACC_RDONLY, H5P_DEFAULT);
if(file_id > 0)
printf("done.\n");
else{
printf("error!\n");
return 1;
};

dataset_id = H5Dopen(file_id, "rettime", H5P_DEFAULT);
space_id = H5Dget_space(dataset_id);
nscans = H5Sget_simple_extent_npoints(space_id);
printf("Total scans: %lld.\n", nscans);
H5Sclose(space_id);
H5Dclose(dataset_id);

dataset_id = H5Dopen(file_id, "specdata/mz", H5P_DEFAULT);
space_id = H5Dget_space(dataset_id);
npeaks = H5Sget_simple_extent_npoints(space_id);
printf("Total MS peaks: %lld.\n", npeaks);
H5Sclose(space_id);

attribute_id = H5Aopen(dataset_id, "min", H5P_DEFAULT);
H5Aread(attribute_id, H5T_NATIVE_DOUBLE, &minmz);
H5Sclose(attribute_id);
attribute_id = H5Aopen(dataset_id, "max", H5P_DEFAULT);
H5Aread(attribute_id, H5T_NATIVE_DOUBLE, &maxmz);
H5Sclose(attribute_id);
printf("M/z range: %f..%f.\n", minmz, maxmz);

H5Dclose(dataset_id);

H5Fclose(file_id);

return;
}

I'm running

>gcc test.c -I"C:\Progra~2\HDF_Group\HDF5\1.8.12\include" -L"C:\Progra~2\HDF_Group\HDF5\1.8.12\lib" -lhdf5 -otest.exe

but I get

C:\Users\paramon\AppData\Local\Temp\ccqrZOee.o:test.c:(.text+0x177): undefined reference to `H5T_NATIVE_DOUBLE_g' C:\Users\paramon\AppData\Local\Temp\ccqrZOee.o:test.c:(.text+0x1c5): undefined reference to `H5T_NATIVE_DOUBLE_g' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Users\paramon\AppData\Local\Temp\ccqrZOee.o: bad reloc address 0x20 in section `.eh_frame' c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status

It seems to be some problem with H5T_NATIVE_DOUBLE or, more generally, with DLLVARs. Without them, the program compiles and runs fine.

Does anyone has experience with building HDF5-dependant code on w32? I wish to write a small demo example for my HDF5-based format; I do not have much C experience, so maybe I'm missing something really simple.

Best wishes,
Andrey Paramonov


--
___________________________________________________________________________
Dr. Werner Benger                Visualization Research
Center for Computation & Technology at Louisiana State University (CCT/LSU)
2019  Digital Media Center, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809                        Fax.: +1 225 578-5362


_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to