Here's the most maintainable way of calling Python from C++. This
method keeps your C++ out of your Python and your Python out of your
C++. As a bonus feature, if the Python implementation gets too slow,
you can rewrite in C++ without needing to touch any client code.
//
// iface.h
struct IFoo {
virtual float wonk(float, float) = 0;
};
//
// iface.sip
%Module foo
class IFoo {
%TypeHeaderCode
#include "iface.h"
%End
public:
virtual float wonk(float, float) = 0;
};
//
// impl.py
from foo import IFoo
class FooImpl( IFoo ):
def wonk( self, n1, n2 ):
return n1 * n2
The only thing left to do in instantiate FooImpl and hand it back to
some C++ function.
James
_______________________________________________
PyKDE mailing list [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde