Boost 1.34 finally simplifies support for Embedded python.
Python2.5 is also supported.
During the process of compiling boost with vc8 in Chinese windows Code Page character warning, but it can be compiled successfully. It does not cause the regular expression library to fail compilation without modifying the source code as in 1.33.1.
The following example is from the boost document: # Include < Iostream >
# Include < String >
# Include < Boost / Python. HPP >
# Include < Boost / Ref . HPP >
# Include < Vector >
Using Namespace Boost: Python;
VoidGreet ()
{
ObjectMain=Import ("_ Main __");
ObjectGlobal (main. ATTR ("_ Dict __"));
// Define greet function in Python.
Object Result = Exec (
" Def greet (a): \ n "
" Return 'Hello % s from python! '% A \ n " ,
Global, global );
ObjectGreet=Global ["Greet"];
List lst;
Lst. append (1);
Lst. append (2);
ObjectR=Greet (LST );
STD ::StringMessage=Extract<STD ::String>(R );
STD: cout<Message<STD: Endl;
}
Int_ Tmain (IntArgc, _ tchar*Argv [])
{
Py_initialize ();
Greet ();
System ("Pause");
Return 0;
}