1

We know we can use SWIG to call C/C++ from Python.

But is that possible to pass on several Python callbacks inside those C/C++?

Basically what I want is: Call C++ from Python: pysomeswig.SomeClass(someargs, some_callback)

where some_callback is a Python routine, and SomeClass can call some_callback one or multiple times in its execution.

Is there a way to achieve this kind of things? Thanks..

Nan Hua
  • 3,414
  • 3
  • 17
  • 24
  • Did you read the fine manual? https://docs.python.org/3/extending/embedding.html – cdarke Aug 06 '16 at 06:34
  • 1
    Duplicate of http://stackoverflow.com/questions/34445045/passing-python-functions-to-swig-wrapped-c-code A reference is given to a fully working example – Jens Munk Aug 06 '16 at 12:17

0 Answers0