Using HDF.PInvoke in VS2010

Hi all,

I’m using HDF5 and HDF.PInvoke for the first time. Our company is heading towards HDF5 as default container for sharing our measurement datasets. This requires among other things a .NET library to ensure our HDF5 conventions.

On nuget I found the HDF.PInvoke package which is the way forward. I hoped for a plug-and-play-experience adding it to my Visual Studio 2010 project but alas, I don’t seem to get it working.
I get a BadImageFormatException using the 1.10 version. If I downgrade to the latest 1.8 version then the objects in the library cannot be found.
(On this machine I have also a python environment with h5py and hdf5 v1.8.15; on my home pc using VS 2015 without h5py I get a dll import exception, ‘hdf5.dll’ missing.)

On support.hdfgroup.org I could not find much information about how to set up a development environment, such as what needs to be additionally installed to use the HDF.PInvoke nuget package and which C# project settings and dependencies are needed to successfully build and run tests.
I probably overlooked it, but I’m looking forward to such information.

Kind regards,

Gerco de Jager

Gerco de Jager | Software Engineer | MARIN Software Group
MARIN | T +31 317 49 33 51 | G.d.Jager@marin.nl<mailto:G.d.Jager@marin.nl> | www.marin.nl<http://www.marin.nl>

[LinkedIn]<https://www.linkedin.com/company/marin&gt; [YouTube] <Maritime Research Institute Netherlands - MARIN - YouTube; [Twitter] <https://twitter.com/MARIN_nieuws&gt; [Facebook] <Facebook;
MARIN news: Seminar 10 jaar Platform Schone Scheepvaart, 6 september, Rotterdam<http://www.marin.nl/web/News/News-items/Seminar-10-jaar-Platform-Schone-Scheepvaart-6-september-Rotterdam.htm&gt;

Gerco, the NuGet package brings its own native dependencies (hdf5[_hl].dll,
szip.dll, zlib.dll) You probably have multiple copies of hdf5[_hl].dll for
different architectures in your PATH. Do a search for hdf5.dll in explorer
and try (for a sanity check) to eliminate them from your PATH environment variable.
The BadImageFormatException means that you are trying to load
a 32(64)-bit version into a 64(32)-bit process, which won’t fly.

G.

···

From: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] On Behalf Of Jager, Gerco de
Sent: Tuesday, August 29, 2017 8:09 AM
To: Hdf-forum@lists.hdfgroup.org
Subject: [Hdf-forum] Using HDF.PInvoke in VS2010

Hi all,

I’m using HDF5 and HDF.PInvoke for the first time. Our company is heading towards HDF5 as default container for sharing our measurement datasets. This requires among other things a .NET library to ensure our HDF5 conventions.

On nuget I found the HDF.PInvoke package which is the way forward. I hoped for a plug-and-play-experience adding it to my Visual Studio 2010 project but alas, I don’t seem to get it working.
I get a BadImageFormatException using the 1.10 version. If I downgrade to the latest 1.8 version then the objects in the library cannot be found.
(On this machine I have also a python environment with h5py and hdf5 v1.8.15; on my home pc using VS 2015 without h5py I get a dll import exception, ‘hdf5.dll’ missing.)

On support.hdfgroup.org I could not find much information about how to set up a development environment, such as what needs to be additionally installed to use the HDF.PInvoke nuget package and which C# project settings and dependencies are needed to successfully build and run tests.
I probably overlooked it, but I’m looking forward to such information.

Kind regards,

Gerco de Jager

Gerco de Jager | Software Engineer | MARIN Software Group
MARIN | T +31 317 49 33 51 | G.d.Jager@marin.nl<mailto:G.d.Jager@marin.nl> | www.marin.nl<http://www.marin.nl>

[LinkedIn]<https://www.linkedin.com/company/marin&gt; [YouTube] <Maritime Research Institute Netherlands - MARIN - YouTube; [Twitter] <https://twitter.com/MARIN_nieuws&gt; [Facebook] <Facebook;
MARIN news: Seminar 10 jaar Platform Schone Scheepvaart, 6 september, Rotterdam<http://www.marin.nl/web/News/News-items/Seminar-10-jaar-Platform-Schone-Scheepvaart-6-september-Rotterdam.htm&gt;

Hi Gerd,

Thank you for pointing this out and responding so quickly. I’ve got it working on both VS 2010 and 2015. :smiling_face:

Instead of hacking PATH (which content is controlled by our IT-department) I am using a post-build event to copy the binaries to the output folder.

Kind regards,
Gerco

···

From: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] On Behalf Of Gerd Heber
Sent: dinsdag 29 augustus 2017 15:38
To: HDF Users Discussion List
Subject: Re: [Hdf-forum] Using HDF.PInvoke in VS2010

Gerco, the NuGet package brings its own native dependencies (hdf5[_hl].dll,
szip.dll, zlib.dll) You probably have multiple copies of hdf5[_hl].dll for
different architectures in your PATH. Do a search for hdf5.dll in explorer
and try (for a sanity check) to eliminate them from your PATH environment variable.
The BadImageFormatException means that you are trying to load
a 32(64)-bit version into a 64(32)-bit process, which won’t fly.

G.

From: Hdf-forum [mailto:hdf-forum-bounces@lists.hdfgroup.org] On Behalf Of Jager, Gerco de
Sent: Tuesday, August 29, 2017 8:09 AM
To: Hdf-forum@lists.hdfgroup.org
Subject: [Hdf-forum] Using HDF.PInvoke in VS2010

Hi all,

I’m using HDF5 and HDF.PInvoke for the first time. Our company is heading towards HDF5 as default container for sharing our measurement datasets. This requires among other things a .NET library to ensure our HDF5 conventions.

On nuget I found the HDF.PInvoke package which is the way forward. I hoped for a plug-and-play-experience adding it to my Visual Studio 2010 project but alas, I don’t seem to get it working.
I get a BadImageFormatException using the 1.10 version. If I downgrade to the latest 1.8 version then the objects in the library cannot be found.
(On this machine I have also a python environment with h5py and hdf5 v1.8.15; on my home pc using VS 2015 without h5py I get a dll import exception, ‘hdf5.dll’ missing.)

On support.hdfgroup.org I could not find much information about how to set up a development environment, such as what needs to be additionally installed to use the HDF.PInvoke nuget package and which C# project settings and dependencies are needed to successfully build and run tests.
I probably overlooked it, but I’m looking forward to such information.

Kind regards,

Gerco de Jager

Gerco de Jager | Software Engineer | MARIN Software Group
MARIN | T +31 317 49 33 51 | G.d.Jager@marin.nl<mailto:G.d.Jager@marin.nl> | www.marin.nl<http://www.marin.nl>

[LinkedIn]<https://www.linkedin.com/company/marin&gt; [YouTube] <Maritime Research Institute Netherlands - MARIN - YouTube; [Twitter] <https://twitter.com/MARIN_nieuws&gt; [Facebook] <Facebook;
MARIN news: Seminar 10 jaar Platform Schone Scheepvaart, 6 september, Rotterdam<http://www.marin.nl/web/News/News-items/Seminar-10-jaar-Platform-Schone-Scheepvaart-6-september-Rotterdam.htm&gt;