From: David Abrahams (dave_at_[hidden])
Date: 2005-05-11 08:19:11
Neb Naic <niacneb_at_[hidden]> writes:
> 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
Note how the __main__ module is accessed there. You can get ahold of
individual attributes (functions, variables, classes) in that module
object some_thing = main_namespace.attr("whatever")
-- Dave Abrahams Boost Consulting www.boost-consulting.com