We are experiencing a problem when using xerces and dynamic_cast.
The problem happens on a RedHat (7.1) Linux kernal 2.4 that has a gnu gcc
with the library
libstdc++-3-libc6.2-2-2.10.0.a libstdc++-3-libc6.2-2-2.10.0.so
An help is appreciated.
san
P.S.
Bellow is a simple test code, cast.cpp
Compile and test it with these steps:
1. compile
g++ -Wall -g -I. -I/usr/local/xerces-c1_5_1-linux/include -I/opt/mqm/inc -c
-o cast.o cast.cpp
2. load to create qt
g++ -o qt query.o cast.o
3. load to create qf, with the lib xerces
g++ -o qf query.o cast.o -lxerces-c1_5_1
-L/usr/local/xerces-c1_5_1-linux/lib
qt works:
[slin@ltang2 ~/csi]$ ./qt
b is indeed a B
while qf crashes:
[slin@ltang2 ~/csi]$ ./qf
Segmentation fault (core dumped)
------cast.cpp---
#include <iostream>
#include <string>
class A
{
char* name;
public:
A()
{
name = "A";
}
virtual string GetName () = 0;
};
class B : public A
{
char* name;
public:
B()
{
name = "B";
}
virtual string GetName()
{
return name;
}
};
int main(int argc, char* argv[])
{
A* b = new B;
if (dynamic_cast<B*>(b)) {
cout << "b is indeed a B" << endl;
}
else {
cout << "b is not a B" << endl;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]