Code Monkey home page Code Monkey logo

hdf.pinvoke's Introduction

Getting started with HDF.PInvoke

We have fairly complete coverage of the HDF5 1.8.16 API, and declarations for HDF5 1.10 are under development. The easiest way to get started with HDF.PInvoke is to use the NuGet package:

Install-Package HDF.PInvoke

If you want to get your hands dirty, clone or fork the repo, and read on!

How you can help

  • Build it and run the tests
  • Submit issues
  • Submit pull requests addressing issues
  • Make suggestions on how to better organize, document, and maintain the software
  • Spread the word
  • ...

Dependencies

HDF5 binaries can be obtained from here. The HDF.PInvoke.dll managed assemblies, located in bin\[Debug,Release], depend on the unmanaged DLLs hdf5.dll, hdf5_hl.dll, szip.dll, and zlib.dll for the corresponding processor architecture.

H5.open() and H5.close() are the Alpha and Omega of the HDF5 library: H5.open() initializes the HDF5 library and should always be called near the beginning of your program - usually the very first line! (If you are dealing with a complex control flow with multiple entry points, there is no harm in calling it more than once.) H5.close() is the counterpart of H5.open(). It will attempt to shut down the library, and release all associated resources. It is usally called automatically on application exit, but it's good practice to make it explicit and check for potential errors. If the library cannot shut down cleanly, there's a good chance that there's a bug in your application or in HDF5, or both, and the risk of file corruption, unless your are only reading files, is non-negligible.

Upon the first call to an H5* function (Remember H5.open()?), the application's configuration file (e.g., YourApplication.exe.config) is searched for the key NativeDependenciesAbsolutePath, whose value, if found, is added to the DLL-search path. If this key is not specified in the application's config-file, then the HDF.PInvoke.dll assembly detects the processor architecture (32- or 64-bit) of the hosting process and expects the unmanaged DLLs in the bin32 or bin64 subdirectories relative to its own location. For example, if HDF.PInvoke.dll lives in C:\bin, it expects the unmanaged DLLs in C:\bin\bin32 and C:\bin\bin64.

Changing the DLL-search path is done using the PATH variable of the running process. An attempt to modify the running processes PATH environment is made, if that fails, the native binaries will be loaded from their default places (as hopefully installed by the HDF5-Installer).

Structure

Currently, the Visual Studio Solution has two projects, HDF.PInvoke and UnitTests, which should be fairly self-explanatory. For each API (H5, H5A, etc.) there is one file, which contains the corresponding PInvoke declarations. They follow closely the native C-headers. Finally, there's one folder for each API in the UnitTests project with one file (of TestMethod definitions) for each API call.

Visual Studio Solution

hdf.pinvoke's People

Contributors

gheber avatar dsanchen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.