[C++-SIG] Python calling C++ issues

Geoffrey Furnish furnish at actel.com
Thu Dec 2 19:44:37 CET 1999


skaller writes:
 > Geoffrey Furnish wrote:
 > > For the Python/C++ interface, this basically means you need a seperate
 > > extension type object for each C++ object you wish to register as a
 > > Python extension.
 > 
 > 	I don't believe this is the case. See below.
 >  [...]
 > 	I will give an example, by taking
 > a tiny subset of the python virtual functions:
 > the len function, for example:
 > 
 > 	class cpp_py_object {
 > 	virtual int len() const = 0;
 > 	...
 > 	};
 > 
 > 
 > 	Now, by using THIS class as the sole base
 > of all cpp extension types, you only need a single
 > CPython type, with a pointer to the C++ object
 > of type cpp_py_object.

Okay, great.  So we can invoke the virtual function len() on an
extension object of unknown type.

Now what's the plan for invoking non virtual methods of C++ objects
without knowing their type?

-- 
Geoffrey Furnish            Actel Corporation        furnish at actel.com
Senior Staff Engineer      955 East Arques Ave       voice: 408-522-7528
Placement & Routing     Sunnyvale, CA   94086-4533   fax:   408-328-2303

"... because only those who write the code truly control the project."
						      -- Jamie Zawinski




More information about the Cplusplus-sig mailing list