Hi, folks, I’m having an issue with the H5Exception class that’s causing all sorts of other weird errors. I’m running the C++ code below in VS Community 2017 (it is the contents of a source file that gets exported to a DLL, which gets called by another app), with HDF 1.12.0. When I build the DLL, I get two warnings, both C4251:
- ‘H5::Exception::detail_message’: class ‘std::basic_string<char,std::char_traits,std::allocator>’ needs to have dll-interface to be used by clients of class ‘H5::Exception’
- ‘H5::Exception::func_name’: class ‘std::basic_string<char,std::char_traits,std::allocator>’ needs to have dll-interface to be used by clients of class ‘H5::Exception’
Then, when the console app is run and the function is called, the line that declares grX throws an error that, after a few calls, reads
Exception thrown: read access violation.
_Pnext was 0xFFFFFFFFFFFFFFFF. occurred.
I think there’s at least one other thread here having H5::Exception issues of this type, but it never got resolved, so I wanted to see if a new thread could yield any info.
#include “pch.h”
#include “H5Lib1.h”
#include
#include
#include “H5Cpp.h”
#include <H5Exception.h>
int getTagNum(char* filename) {
H5::H5File file(filename, H5F_ACC_RDONLY);
H5::Group tag_group(file.openGroup(“Tags”));
hsize_t numTagsSets = tag_group.getNumObjs();
std::cout << "There are " << numTagsSets << " objects in this group." << std::endl;
H5std_string grX = tag_group.getObjnameByIdx(1);
return 1;
}