Re: HDF read example



fj wrote:
On 27 mai, 18:54, clay.blankens...@xxxxxxxxx wrote:
I need to write a program to read HDF files and am having a hard time
finding a simple example of a program and compiling instructions.
Specifically, which include files do I need to use? I tried including
hdf.f90 and dffunc.f90 but I get a whole list of undefined symbols.

Thanks,
Clay Blankenship
National Space Science and Technology Center

You need to compile HDF5 with the same F90 compiler you use. HDF5 is
written in C and has a F90 extension.

Your program must contain :

PROGRAM test
USE hdf5
...
END PROGRAM

Of course you need to compile in providing the location of the file
hdf5.mod (coming from the correct installation of HDF5).

After that, you need to link with the HDF5 library

On my computer, I needed to install HDF5 for various compilers. For
the compiler "ifort" for instance, the main files are :

/usr/local/hdf5-ifort/lib/libhdf5.so
/usr/local/hdf5-ifort/lib/hdf5.mod

When compiling : ifort -c -I/usr/local/hdf5-ifort/lib test.f90
When linking : ifort -L/usr/local/hdf5-ifort/lib test.o -lhdf5

This is a total stab in the dark assuming you're using a certain compiler, but when I started doing something similar with the netcdf library using gfortran or g95, I needed to use the "-fno-second-underscore" flag when I compiled the fortran and fortran90 API.

I have zero experience with any form of HDF, but it should be an easy test. The names of the undefined symbols (extra underscores?) should tell you if the test is even worth doing.

cheers,

paulv

.



Relevant Pages

  • Re: asking for help
    ... I read the notes abot this matter and I tried to ... >How can I get some help regarding to the understanding how Hdf5 works? ... there is no native equivalent of the F90 ... for a f90 compiler, though I imagine it exists somewhere. ...
    (freebsd-questions)
  • Re: Do different compilers produce different .mod files?
    ... When I used HDF5, I used to compile HDF5 with various fortran ... compiler if you have to. ... Best regards, ...
    (comp.lang.fortran)
  • Re: if x=y or z or .....
    ... Yes, it's legal nonsense in C, evaluating to TRUE;-) ... This will prevent some ill behaved C compiler (do you know of sane C compilers? ... That's why ANSI requires that the preprocessor has to ... be incorporated into an C compiler, so that undefined symbols will evaluate to ...
    (comp.lang.pascal.delphi.misc)