I get the following error when executing my program:
E:Unable to load libsim.so: libsim.so: undefined symbol: _ZTV15IteratorRegFile
in sim.cpp there is s.th. like
//IteratorRegFileIs is a wrapper that calls the constructor for IteratorRegFile
Fwk::Ptr<IteratorRegFile> iteratorRegFile_ = IteratorRegFile::IteratorRegFileIs( "RF" );
void init(){
SparseArrayInt64 *sparse_array = new SparseArrayInt64(segID);
}
in SparseArrayInt64.cpp:
extern Fwk::Ptr<IteratorRegFile> iteratorRegFile_;
IteratorRegFile.h:
public:
static IteratorRegFile::ValidPtr IteratorRegFileIs(Tac::Name _name) {
IteratorRegFile * m = new IteratorRegFile(_name);
m->referencesDec(1);
return m;
}
protected:
IteratorRegFile( const IteratorRegFile& );
explicit IteratorRegFile(Tac::Name _name): Tac::Entity(_name),
index_(0) {
handleInit();
}
Any idea why the compiler is mangling the function so the lib doesn’t find it anymore?
If you do this on Linux with gcc:
According to c++filt
_ZTV15IteratorRegFileisvtable for IteratorRegFile. So the mangled name refers to vtvable, not your function.I did some search and found this advice
"You must implement virtual methods of your class because that's when the compiler actually generates the vtable for it."You can check what symbols there are in a module in this way:
nm your-module-nameI guess this links might help: