使用BOOST在程序中嵌入PYTHON代码
#include
using namespace boost::python;
int main()
{
Py_Initialize();
handle<> main_module(borrowed( PyImport_AddModule("__main__") ));
handle<> main_namespace(borrowed( PyModule_GetDict(main_module.get()) ));
handle<>( PyRun_String("hello = file('hello.txt', 'w')/n"
"hello.write('Hello world!')/n"
"hello.close()", Py_file_input,
main_namespace.get(), main_namespace.get()) );
Py_Finalize();
}