[C++-sig] Embedded Python and calling back into Python from C++

Ron Brown, Jr. rbrown at gamry.com
Thu Apr 5 16:39:26 CEST 2007


I have what might be a ridiculous question for you all regarding 
embedded python.  Hopefully I can explain it properly.  I'm going to 
explain it within the context of Boost.Python, as that's what we're 
planning on using.

If we write a Python module and also embed Python with Boost.Python, and 
in the embedded python call back into C++, and then in that C++ call 
back into Python, what happens?

I'll try and explain that a bit more clearly.

1.) Write Python Module
2.) Embed Python Interpreter
3.) Import Python Module
4.) Call C++ function via Boost.Python from embedded Python
5.) Call Python function via Boost.Python from C++ function that was 
originally called by Python

Is that possible?  Would Python's thread be busy waiting for the initial 
C++ function to return?

Thanks!

-Ron




More information about the Cplusplus-sig mailing list