Creating a HDF5 file

0

I'm trying to create a hdf5 file with Visual Basic code:

Module file_operations

    Sub Main()
        Dim fileid As Long
        Dim h5 As Integer
        h5 = HDF.PInvoke.H5.open()  ' <===Error at this line==<<

        fileid = HDF.PInvoke.H5F.create("file_name.h5", HDF.PInvoke.H5F.ACC_TRUNC)
        Dim group1 As Long = HDF.PInvoke.H5G.create(fileid, "/home")
        Dim group2 As Long = HDF.PInvoke.H5G.create(group1, "/music")

        HDF.PInvoke.H5F.close(fileid)
        Console.WriteLine("End of Program")
    End Sub

End Module

First, I tried installing the latest HDF.PInvoke 1.10 through the Package Manager Console. Later I tried installing the HDF.PInvoke 1.8. In both situations, I had the same error when I run the program.

   System.BadImageFormatException was unhandled
      HResult=-2147024885
      Message=An attempt was made to load a program with an incorrect format. (Exception from HRESULT 0x8007000B)
      Source=HDF.PInvoke
      StackTrace:
       in HDF.PInvoke.H5.open()
       in hdf3.file_operations.Main() at C:\Users\...\hdf3\hdf3\file_operations.vb:line 6
       in System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       in System.Threading.ThreadHelper.ThreadStart()
  InnerException:

The first time I have runned with the default option (Any CPU), so I've optained the exeption above. So I read about the "An attempt was made to load a program with an incorrect format" exception then according to the recommendation I marked Prefer 32-bit option at the properties of my project like displays at the follow screenshot. Finally, I runned again, but the same exeption was threw.

MyProject

.net
vb.net
hdf5
asked on Stack Overflow Oct 1, 2017 by Adolfo Correa • edited Oct 3, 2017 by Adolfo Correa

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0