[K42-discussion] virtual destructors

Donour Sizemore donour at cs.unm.edu
Fri Jul 14 04:44:47 EST 2006


Bryan S Rosenburg wrote:
>
> I hope it's not necessary to stick a virtual destructor (and the 
> apparently-necessary delete operator) into every StubXXX class.  Have 
> you tried putting an empty destructor and a DEFINE_NOOP_NEW() 
> invocation into lib/libc/cobj/StubBaseObj.H ?  All generated stub 
> objects are ultimately derived from StubBaseObj, so I hope that a 
> virtual desstructor there is all that's needed.
You're right. I don't think it is. A destructor in StubBaseObj gets rid 
of a lot of warnings. Unfortunately, it's not just a two line fix.

>
>
> I took a quick look at StubBaseObj.H and was surprised to find a "new" 
> operator declared there.  I couldn't find a corresponding 
> implementation, so I'm not sure what the declaration is needed for. 
>  Maybe you can get rid of it when you add a DEFINE_NOOP_NEW.

The implementation is in lib/libc/sys/ppccore.C and it does do work (not 
just a call to __no_built_ins). This means that I can just replace it 
with a NOOP_NEW. It seems it will need to have it's own operator delete* 
that panics if it ever gets called.
>
> > However I'm coming up with missing symbols.
> >
> >
> > powerpc64-linux-nm -p k42sys.o | egrep -w U
> >                  U __dso_handle
> >                  U .__cxa_atexit
>
> Let's see what the undefined symbol story is after you try the 
> StubBaseObj.H change.
>
The solution above did nothing about this link error. I had to add 
atexit code to ProgExecUsr.C AND InitServer.C.

donour




More information about the K42-discussion mailing list