[K42-discussion] virtual destructors

Bryan S Rosenburg rosnbrg at us.ibm.com
Thu Jul 13 08:39:00 EST 2006


Donour Sizemore wrote on 07/12/2006 05:32:35 PM:
> 
> >
> > Donour, can you try inserting a DEFINE_NOOP_NEW() invocation into 
> > VAllocServices() (and anywhere else you've had to define virtual 
> > destructors), and see if that clears up the undefined symbol?
> So the trickiest of these that I've found are the StubHEADER.H that 
> subgen generates. The natural solution is to emit a virtual destructor 
> along with each stub file. Something like:
> 
> --
> ...
> 
> printf("\tDEFINE_NOOP_NEW(%s);\n", sclass)   > SF;
> printf("\tvirtual ~%s() { }\n", sclass)      > SF;
> printf("};\n\n")                             > SF;

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.

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.

> 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.

- Bryan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ozlabs.org/pipermail/k42-discussion/attachments/20060712/a1e89456/attachment.htm 


More information about the K42-discussion mailing list