Boost.Python embedding/extending example

Hello, I have an application that I need to both embed and extend Python. The Python portion is actually an existing plotting utility that I�m trying to leverage in a legacy C++/OpenGL application. The Boost.Python tutorial has helped me successfully expose my C++ classes to Python. However, I�m having difficulty embedding the Python � accessing Python interfaces from C++. The tutorial examples seem to lean toward embedding Python statements rather than actually addressing interface issues (IMHO). Assuming the Python code to embed is in its own file (not actually embedding Python statements), does Boost.Python provide an encapsulated class or functional interface? Documentation/examples? Any help is greatly appreciated. Thanks, Niac __________________________________ Do you Yahoo!? Make Yahoo! your home page http://www.yahoo.com/r/hs

Neb Naic <niacneb@yahoo.com> writes:
Hello,
I have an application that I need to both embed and extend Python. The Python portion is actually an existing plotting utility that Im trying to leverage in a legacy C++/OpenGL application.
The Boost.Python tutorial has helped me successfully expose my C++ classes to Python. However, Im having difficulty embedding the Python accessing Python interfaces from C++. The tutorial examples seem to lean toward embedding Python statements rather than actually addressing interface issues (IMHO).
That's pretty vague.
Assuming the Python code to embed is in its own file (not actually embedding Python statements), does Boost.Python provide an encapsulated class or functional interface? Documentation/examples?
Any help is greatly appreciated.
There are some examples in libs/python/test/embedding.cpp http://www.boost-consulting.com/boost/libs/python/test/embedding.cpp Note how the __main__ module is accessed there. You can get ahold of individual attributes (functions, variables, classes) in that module via object some_thing = main_namespace.attr("whatever") HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Neb Naic