This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: C++, dlopen() and undefined __pure_virtual


Hi H.J.:

I am certainly running Linux (actually RH AS-2.1).
I think the "ld" would work fine because what i am doing is just
liking the objects in to create the shared library. Infact I remember
having tested the process of ".so" creation using ld previously.
The problem, I feel is elsewhere...

Thanks for the quick response.

Regards,
BDutta

> -----Original Message-----
> From: binutils-owner@sources.redhat.com 
> [mailto:binutils-owner@sources.redhat.com] On Behalf Of H. J. Lu
> Sent: Friday, April 23, 2004 9:28 PM
> To: Banibrata Dutta
> Cc: binutils@sources.redhat.com
> Subject: Re: C++, dlopen() and undefined __pure_virtual
> 
> 
> On Fri, Apr 23, 2004 at 09:24:26PM +0530, Banibrata Dutta wrote:
> > hi,
> > 
> > i have a peculiar scenario. let me explain it briefly, and 
> my problem 
> > had something to do with demand loading via
> > 
> > A  B  C
> > ^  ^  ^
> > |  |  |
> > X  Y  Z
> > 
> > i.e. A, B and C are 3 base classes and X, Y, Z are their concrete 
> > implementations. the program's main() uses the interface 
> exposed by A, 
> > B & C i.e. the virutal functions, to invoke the real 
> implementation in 
> > X, Y, Z class.
> > 
> > i have 1 binary (executable) that contains A,B,C amongst 
> other things, 
> > and a shared object e.g. xyz.so containing X,Y & Z.
> > 
> > conceptually what i want to do is to:
> > 
> >   handle = dlopen("./libxyz.so", RTLD_GLOBAL);
> >   createAobjPtr = (A_FNPTR*) dlsym(handle, "createAobj");
> >   A *aPtr = (*createAobjPtr)();
> > 
> > everything goes file and links well. but when i run the 
> executable it 
> > fails saying (due to my calling dlerror()), that:
> > 
> >  libxyz.so: undefined symbol: __pure_virtual
> > 
> > what is happening ?? what is really the cause ??
> > 
> > i've created the shared object as follows:
> > $ ld -shared -soname libxyz.so -o libxyz.so -lc X.o -lc Y.o -lc Z.o 
> > -lc A.o -lc B.o -lc C.o -lpthread -lm -ldl
> 
> Are you running Linux? If yes, use "g++ -shared", not "ld -shared".
> 
> 
> H.J.
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]