[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

multiple destructors - which gets linked in?

From: Andy Green
Subject: multiple destructors - which gets linked in?
Date: Fri, 09 Jul 2004 15:41:25 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040616

Not a bug report, but a question. In the class hierarchy below, if I compile to intermediate (assembler) files, I can see multiple destructors for base and derived, e.g. DerivedD0Ev, DerivedD1Ev, DerivedD2Ev, and multiple instantiations of each in different compilation units.

class Base
    // a few methods

    virtual ~Base();

class Derived : public Base
    // a few more methods, some overridden
    // DESTRUCTOR NOT OVERRIDDEN - let compiler generate it

class ReallyDerived : public Derived
    // again, just use the compiler-generated destructor

I need to know which instance of DerivedD2Ev gets linked into the final executable (don't ask why...), so I modified the assembler files and continued the build. However my modifications (inserted instructions) never make it into the final build. If I modify any other function, I see my changes appear in the binary, but not these destructors.

Interestingly, there is no instance of it in Derived.S, just in ReallyDerived.S and in another file which references it. I guess there must be another instantiation of DerivedD2 somewhere, but I can't find it. Can anyone suggest what is going on?

[We're using arm-elf-g++ 3.2 and arm-elf-ld version 2.13]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]