H5S_SELECT_OR_F enumeration not visible in application

Hello,

I am static linking into HDF5 1.8.9 library to build my FORTRAN application which links into other C/C++ DLLs. I am trying to use hyperslab union method to read from a dataset. I was expecting the availability of H5S_SELECT_OR_F enumeration value when HDF5 module is included via 'USE HDF5' statement. However when the program runs, it crashes due to H5S_SELECT_OR_F value being 0. When I built a simple FORTRAN test program (no other DLLs), there is no such problem. I saw from HDF5 source code that the enumeration value is set via an equivalence statement in H5GLOBAL module. Since this is included in HDF5 module, I am not sure why the enumeration value is not visible. I tried building hdf5_fortran static library from source as well as using pre-built libraries from HDF5 ftp site. But neither option works in my original application.

FWIW here is my build environment - VS 2010 and Intel Fortran Compiler (v12.1). Any help will be appreciated.

Thanks,
Vikram

Is it possible for you to try the 1.8.16 release and report back if you still have the same issue? You did call h5open_f, correct?

Scot

···

On Apr 4, 2016, at 6:41 PM, Bhamidipati, Vikram <vikram.bhamidipati@swri.org<mailto:vikram.bhamidipati@swri.org>> wrote:

Hello,

I am static linking into HDF5 1.8.9 library to build my FORTRAN application which links into other C/C++ DLLs. I am trying to use hyperslab union method to read from a dataset. I was expecting the availability of H5S_SELECT_OR_F enumeration value when HDF5 module is included via ‘USE HDF5’ statement. However when the program runs, it crashes due to H5S_SELECT_OR_F value being 0. When I built a simple FORTRAN test program (no other DLLs), there is no such problem. I saw from HDF5 source code that the enumeration value is set via an equivalence statement in H5GLOBAL module. Since this is included in HDF5 module, I am not sure why the enumeration value is not visible. I tried building hdf5_fortran static library from source as well as using pre-built libraries from HDF5 ftp site. But neither option works in my original application.

FWIW here is my build environment – VS 2010 and Intel Fortran Compiler (v12.1). Any help will be appreciated.

Thanks,
Vikram
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Thanks to Scott and Timothy I narrowed down the problem and confirmed it in a test program. I am posting this incase it helps others. Here is how my test program looks like:

1. First I built a DLL (read_data.DLL) that static links with HDF5 library. This DLL has a subroutine to open a HDF5 file in read-only and selects hyperslabs by union method and stores in memory hyperslab with same number of elements. It closes the file and exits.

2. Then I wrote a driver that calls h5open_f to initialize Fortran interface and then writes out a dataset and close it. The file is also closed. Then the subroutine from DLL is called and the data is displayed to screen output.

The above program is a modification of the hyperslab example available on HDF5 website. It seems like the problem is that the main application can see the global variables and common block memory but the DLL cannot. I confirmed this by writing to stdout the variable values. When I called h5open_f in DLL also the problem went away. The problem seems to stem from static linking against HDF5 libraries for both application and DLL. If I dynamically link, and share the library against the application and my read_data DLL, this problem goes away.

Thank you,
Vikram

Yes. I did call h5fopen_f (I assume there was a typo in reply below) to open the file. I am using OPENMP in my original application. I did try turning off OPENMP but it did not help. I'll try printing other enumerations to see if they are visible. Are there some other diagnostics I can try?

Thanks,
Vikram

···

-----Original Message-----
From: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] On Behalf Of hdf-forum-request@lists.hdfgroup.org
Sent: Tuesday, April 5, 2016 12:00 PM
To: hdf-forum@lists.hdfgroup.org
Subject: Hdf-forum Digest, Vol 82, Issue 6

Send Hdf-forum mailing list submissions to
  hdf-forum@lists.hdfgroup.org

To subscribe or unsubscribe via the World Wide Web, visit
  http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

or, via email, send a message with subject or body 'help' to
  hdf-forum-request@lists.hdfgroup.org

You can reach the person managing the list at
  hdf-forum-owner@lists.hdfgroup.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of Hdf-forum digest..."

Today's Topics:

   1. Re: H5S_SELECT_OR_F enumeration not visible in application
      (Scot Breitenfeld)

----------------------------------------------------------------------

Message: 1
Date: Tue, 5 Apr 2016 16:52:44 +0000
From: Scot Breitenfeld <brtnfld@hdfgroup.org>
To: HDF Users Discussion List <hdf-forum@lists.hdfgroup.org>
Subject: Re: [Hdf-forum] H5S_SELECT_OR_F enumeration not visible in
  application
Message-ID: <BB9DC8F3-DD4A-4F32-A788-B99B2435EDB3@hdfgroup.org>
Content-Type: text/plain; charset="utf-8"

Is it possible for you to try the 1.8.16 release and report back if you still have the same issue? You did call h5open_f, correct?

Scot

On Apr 4, 2016, at 6:41 PM, Bhamidipati, Vikram <vikram.bhamidipati@swri.org<mailto:vikram.bhamidipati@swri.org>> wrote:

Hello,

I am static linking into HDF5 1.8.9 library to build my FORTRAN application which links into other C/C++ DLLs. I am trying to use hyperslab union method to read from a dataset. I was expecting the availability of H5S_SELECT_OR_F enumeration value when HDF5 module is included via ?USE HDF5? statement. However when the program runs, it crashes due to H5S_SELECT_OR_F value being 0. When I built a simple FORTRAN test program (no other DLLs), there is no such problem. I saw from HDF5 source code that the enumeration value is set via an equivalence statement in H5GLOBAL module. Since this is included in HDF5 module, I am not sure why the enumeration value is not visible. I tried building hdf5_fortran static library from source as well as using pre-built libraries from HDF5 ftp site. But neither option works in my original application.

FWIW here is my build environment ? VS 2010 and Intel Fortran Compiler (v12.1). Any help will be appreciated.

Thanks,
Vikram
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/attachments/20160405/29c8a2f4/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org

------------------------------

End of Hdf-forum Digest, Vol 82, Issue 6
****************************************

Hi Vikram,

It wasn't a typo by Scott. The fortran API requires you to open the library before you use it.

https://www.hdfgroup.org/HDF5/doc/RM/RM_H5.html#Library-Open

Hope this helps.
Tim

···

________________________________________
From: Hdf-forum <hdf-forum-bounces@lists.hdfgroup.org> on behalf of Bhamidipati, Vikram <vikram.bhamidipati@swri.org>
Sent: Tuesday, April 5, 2016 11:08 AM
To: hdf-forum@lists.hdfgroup.org
Subject: Re: [Hdf-forum] Hdf-forum Digest, Vol 82, Issue 6

Yes. I did call h5fopen_f (I assume there was a typo in reply below) to open the file. I am using OPENMP in my original application. I did try turning off OPENMP but it did not help. I'll try printing other enumerations to see if they are visible. Are there some other diagnostics I can try?

Thanks,
Vikram

-----Original Message-----
From: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] On Behalf Of hdf-forum-request@lists.hdfgroup.org
Sent: Tuesday, April 5, 2016 12:00 PM
To: hdf-forum@lists.hdfgroup.org
Subject: Hdf-forum Digest, Vol 82, Issue 6

Send Hdf-forum mailing list submissions to
        hdf-forum@lists.hdfgroup.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

or, via email, send a message with subject or body 'help' to
        hdf-forum-request@lists.hdfgroup.org

You can reach the person managing the list at
        hdf-forum-owner@lists.hdfgroup.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of Hdf-forum digest..."

Today's Topics:

   1. Re: H5S_SELECT_OR_F enumeration not visible in application
      (Scot Breitenfeld)

----------------------------------------------------------------------

Message: 1
Date: Tue, 5 Apr 2016 16:52:44 +0000
From: Scot Breitenfeld <brtnfld@hdfgroup.org>
To: HDF Users Discussion List <hdf-forum@lists.hdfgroup.org>
Subject: Re: [Hdf-forum] H5S_SELECT_OR_F enumeration not visible in
        application
Message-ID: <BB9DC8F3-DD4A-4F32-A788-B99B2435EDB3@hdfgroup.org>
Content-Type: text/plain; charset="utf-8"

Is it possible for you to try the 1.8.16 release and report back if you still have the same issue? You did call h5open_f, correct?

Scot

On Apr 4, 2016, at 6:41 PM, Bhamidipati, Vikram <vikram.bhamidipati@swri.org<mailto:vikram.bhamidipati@swri.org>> wrote:

Hello,

I am static linking into HDF5 1.8.9 library to build my FORTRAN application which links into other C/C++ DLLs. I am trying to use hyperslab union method to read from a dataset. I was expecting the availability of H5S_SELECT_OR_F enumeration value when HDF5 module is included via ?USE HDF5? statement. However when the program runs, it crashes due to H5S_SELECT_OR_F value being 0. When I built a simple FORTRAN test program (no other DLLs), there is no such problem. I saw from HDF5 source code that the enumeration value is set via an equivalence statement in H5GLOBAL module. Since this is included in HDF5 module, I am not sure why the enumeration value is not visible. I tried building hdf5_fortran static library from source as well as using pre-built libraries from HDF5 ftp site. But neither option works in my original application.

FWIW here is my build environment ? VS 2010 and Intel Fortran Compiler (v12.1). Any help will be appreciated.

Thanks,
Vikram
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org<mailto:Hdf-forum@lists.hdfgroup.org>
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hdfgroup.org/pipermail/hdf-forum_lists.hdfgroup.org/attachments/20160405/29c8a2f4/attachment-0001.html&gt;

------------------------------

Subject: Digest Footer

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

------------------------------

End of Hdf-forum Digest, Vol 82, Issue 6
****************************************

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5