Hi, I've spent a lot of time researching this and I am completely out of ideas, so I am hoping someone else can help me.
I am somewhat new to linux shared library programming so bare with me a bit.
relevant details:
g++ 4.1.2
64bit system and libraries
I have some code that creates a shared library for accessing the firebird database through it's api. There is only a single function that is available in the library, and it is appropriately defined with the extern "C" syntax. It compiles fine, the created shared library is cached with ldconfig. But when the program is executed I receive an undefined symbol error.
For clarity I'll add in some simplified code (but probably still a little complex) below. The code wasn't mine, I'm just trying to get it to compile and run in 64 bit.
When the library load is attempted, the undefined symbol is _ZTI9D, (with D being the name of class d) leading me to believe I need to change something about class d but I'm actually clueless. Here's how the classes are laid out.
In file acd.h
Code:
class a {
public
static a* getObjectOfA(int& type);
virtual c* allocC()
protected
a();
virtual ~a();
private
...
};
class c {
public
virtual ~c();
virtual d* allocD();
d* allocD(const int& command);
protected
c();
a* A;
private
};
class d {
public
virtual ~d();
protected
d();
c* C;
private
};
typedef a* (*getAFunc)();
And in file acd_b.h
Code:
class a_b: public a {
public
a_b();
~a_b();
c* allocC();
protected
friend class c_b;
};
class c_b: public c {
public
c_b(a_b* A_B);
~c_b();
d* allocD();
protected
a_b* A_B;
friend class a_b;
friend class d_b;
}
class d_b: public d {
public
d_b(c_b* C_B);
~d_b();
protected
c_b* C_B;
}
and finally in acd_b.cpp:
Code:
class a_b: {
lots of code...
}
class c_b: {
lots of code...
}
class d_b: {
lots of code...
}
extern "C" {
a* getObjectOfA() {
return new a_b();
}
}
The code is compiled with the following flags:
g++ -c -pipe -march=athlon64 -m64 -fPIC -Wall -W -O2 -D_REENTRANT -fPIC -DLINUX -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_PLUGIN -DQT_SHARED -I/usr/lib64/qt/mkspecs/default -I. -I../utility -I../a -I../widget -I. -I/opt/firebird/include -I/usr/lib64/qt/include -Iobjs/ -o objs/a_b.o a_b.cpp
and the shared library subesquently made with:
g++ -L../lib -Wl,-rpath,/usr/lib64/qt/lib -shared -Wl,-rpath,/home/xxx/Prog/drivers -o liba_b.so objs/a_b.o objs/other.o objs/dialog.o objs/crypt.o objs/moc_other.o -L/usr/lib64/qt/lib -ldl -lqt-mt -lpthread
Any help/suggestions would be greatly appreciated - even if it's some links to go read.
Thanks!