Hi
We have been developing some apps using the Sablot 0.50 library and have recently found a problem and traced it back to Sablotron. Below is some test code which causes a Segmentation Fault when doing a dynamic_cast, but only when I link the sablot ( &expat ) shared libraries.
#include <stdio.h>
#include <sstream>
//#include "sablot.h"
class A
{
public:
virtual void dostuff() { std::cout << "A" << std::endl; }
};
class B : public A
{
public:
void dostuff() { std::cout << "B" << std::endl; }
};
void doit(A& a)
{
try
{
B& b = dynamic_cast<B&>(a); // this dynamic cast causes a SEGMENTATION FAULT
b.dostuff();
}
catch( ... )
{
std::cout << "bad cast" << std::endl;
}
}
int main()
{
std::cout <<"start..."<<std::endl;
A* a = new A();
A* b = new B();
doit(*b); // this fails
return 1;
}
Were using Red Hat 7.0. Has anyone else experienced these problems?
thanks
Mark Turner
- Re: [Sab] Sablot library & dynamic_cast problem Mark Turner
- Re: [Sab] Sablot library & dynamic_cast problem Tom Kaiser
- Re: [Sab] Sablot library & dynamic_cast problem Mark Turner
