创建HDF5文件

时间:2017-10-01 19:01:01

标签: .net vb.net hdf5

我试图用Visual Basic代码创建一个hdf5文件:

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

首先,我尝试通过软件包管理器控制台安装最新的HDF.PInvoke 1.10。后来我尝试安装HDF.PInvoke 1.8。在这两种情况下,我在运行程序时遇到了同样的错误。

   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:

我第一次使用默认选项(任何CPU)运行,所以我已经选择了上面的例子。所以我读了"An attempt was made to load a program with an incorrect format"异常,然后根据我在项目属性上标记为Prefer 32-bit选项的建议,如下面屏幕截图中的显示。最后,我再次跑了,但同样的例子被扔了。

MyProject

0 个答案:

没有答案