This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: shared library - undefined symbols
- From: Anitha Boyapati <anithab at sankhya dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 7 Dec 2006 10:04:00 +0530 (IST)
- Subject: Re: shared library - undefined symbols
On Wed, 6 Dec 2006, Andrew Haley wrote:
> Anitha Boyapati writes:
> >
> > Please let me know if I am missing something.It is important for
> > me to get through this immediately :-(
> >
> > -------------------------------------------
> >
> > Sample Code :
> >
> > class X : class baseX {
> > ...
> > };
> >
> > class Y : class baseY {
> > ...
> > };
> > //End of Code
> >
> > g++ -c -shared -o mem.so X.o Y.o
> >
> > ( This created mem.so )
> >
> > When used with dlopen as :
> >
> > handle = dlopen ("mem.so", RTLD_LAZY)
> >
> > The above statement throws error saying undefined reference to baseX
> > and BaseY!
>
> No kidding. Where are baseX and BaseY defined?
They are also included while building mem.so.But I got the mistake.
I didnt define the virtual methods declared in X and Y out of pure
ignorance :-)
Doesnt it sound right if we have some error or warning thrown for such
cases where definitions are not found while building a shared library?
Since it didnt throw anything during build, I thought my lib is as good
as any that of experts'!
[ This is my first time to use shared libs and (please close your eyes)
I dont even know what a shared lib should contain]
>
> Andrew.
>
--
Regards,
Anitha B,
Sankhya Technologies Private Limited.