[omniORB] Undefined symbol "__pure_virtual"

Wil Evers Wil_Evers@doosys.com
Fri, 28 Jul 2000 10:24:02 +0200


Peter van Heusden wrote:

> Apparently the symbol is used in some way by the compiler
> internals when implementing pure virtual methods. (I found 
> a message describing a virtual function table having an 
> entry of __pure_virtual - maybe __pure_virtual is a placeholder 
> symbol which is used till the actual method to be called is 
> resolved. I don't know enough about C++ to be certain)

Most C++ compilers use the address of a special function
(__pure_virtual) when generating a virtual function table entry for a
pure virtual member function.   Usually, this function first prints a
message ('pure virtual called' or somesuch) and then aborts, which is
better than simply crashing.

If you ever see such a message, it normally means you (indirectly) tried
to call a pure virtual from a constructor or destructor. For example: 

  class Base {
  public :
    Base();
    virtual void pure() = 0;
  };

  void f(Base *b)
  {
    b->pure();
  }
  
  Base::Base()
  {
    f(this); // boom!
  }


- Wil
Wil Evers, DOOSYS IT Consultants, Maarssen, Holland