vfunc question



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

After being able to load my C++ plugin in Anjuta I have a problem
calling it's activate function.

bool activate() is a virtual function wrapped using _WRAP_VFUNC().
However, the C code calls klass->activate which ends up calling
Anjuta::Plugin::activate_vfunc_callback which then calls
Plugin::activate_vfunc().

Anyway, activate_vfunc() contains

bool Anjuta::Plugin::activate_vfunc()
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the
parent class of the object class (The original underlying C class).
  );

  if(base && base->activate)
    return (*base->activate)(gobj());

  typedef bool RType;
  return RType();
}

But this code will never ever calls the overridden activate() function
of my derived SamplePlugin class. Is this intended? I feel that I
completely misunderstand some things with virtual functions because what
I want is that klass->activate() ends up calling SamplePlugin::activate().

Thanks and regards,
Johannes
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFEoqP7Dsf+G5b/WsRAtX/AKColNnV5zlE8dCycjED3pR3xQqU6QCeNUts
4LWTt9B8Gy61+SG67xrywU8=
=3XBn
-----END PGP SIGNATURE-----



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