我有C++程序,我想补充扩展系统与Python。但为了实现这一点,我必须将Python对象方法调用映射到C++方法调用。这是可能的,如果是的话,如何实现。C++和Python紧密集成
例:
Python的部分:
class Extension(AbstractExtension):
def __init__(self, cool_cpp_object):
self.o = cool_cpp_object
def some_method(self):
self.o.method_to_cpp()
C++部分:
class SomeClass : public AnotherClass
{
public:
void method_to_cpp();
}
我不得不SomeClass的实例传递到扩展实例方法。谢谢。
Give [Boost.Python](http://www.boost.org/doc/libs/1_62_0/libs/python/doc/html/tutorial/tutorial/exposing.html#tutorial.exposing.constructors)a go – StoryTeller