0
class ICallback
{
       public: virtual void OnEvent(int a,char*  b) = 0;
};
class MyListener :public ICallback
{
    public: virtual void OnEvent(int a, , char*  b){code here}
};

int OnComplete(char* ID, ICallback* Listener);

Hello, I have such code in C++ and I need to call OnComplete method from Python.

Please pay attention that I have to create MyListener in python, implement OnNavigationEvent in python and call OnComplete of C++.

Is it possible?

Update: I can't touch "OnComplete" method code, it's third party library

Update 2: Here is the perfect example, very compact and understandable for people like me, new for python: http://eli.thegreenplace.net/2008/08/31/ctypes-calling-cc-code-from-python/ I just can't answer on my own question because a reputation < 10 :)

1 Answer 1

1

It's possible, but it's not trivial; the process is too involved to try and describe it here. Fortunately the Python team provides a handy document that describes how to do it.

Sign up to request clarification or add additional context in comments.

1 Comment

Jeremy's right... The Python docs are good, and often worth reading when you're trying to do something with Python

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.