How to create Python object in C/C++ extension by class name?

Neil.Fang.CN NeilFang2008 at gmail.com
Mon Mar 10 05:25:04 EDT 2008


Hello

I'm trying to write a C++ extension like this:

//-----------------------------------------------------------------------
// C++ code
class ActorBase
{...};

// export ActorBase to Python as a new type

class ActorManager
{
  void addNewActor(const char* actorClassName)
   {
      ?????
   }
}

// export ActorManagerto Python as a new type
//-----------------------------------------------------------------------

The question is how to implement ActorManger::addNewActor(), I want
the class name can be a Python class which inherits the C++ class
ActorBase?

Thanks

-- Neil



More information about the Python-list mailing list