Boost 1.34 finally simplifies support for Embedded Python

Source: Internet
Author: User
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;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.