Some understandings of Python embedding into C + +

Source: Internet
Author: User
1. Introduction (compare their characteristics, ask questions) C + + and Python are used in a more extensive language, each has its advantages; C + + performance, Python simple convenience library rich, if you can combine the use of both good. Python is a scripting language that the interpreter translates into executable code. Python is powerful, it provides C + + calls, meaning that C/D + + can embed Python code, in reality you can play the advantages of both languages. 2. How to implement on the implementation, Python provides a C interface for use in C/C + +, to provide include and Lib in the form of a Lib library in the language, and Python.h and python27.lib can be found in the Python installation directory. Python provides three forms of "embedding"------Code strings,callable Objects,code Filescode strings, passed directly to the interpreter as a string, and some return values can be obtained. Callable objects, load a python file first, and then call the function or variable in the file. Code files, loaded directly in the form of a python file. Essentially, these features are provided through Python's set of C interfaces, which can be used for the time being, and then learn when you need them later. 3. What other libraries are PYTHONQT: 2.8 and 3.0 (QT4.8) have not been tested successfully. Boost.python: Not tried. Related: First knowledge python and qt:http://mobile.51cto.com/symbian-268735.htmprogramming python, 3rd edition:http:// Wiki.woodpecker.org.cn/moin/pp3ed/ch-23-2 embed python in the QT program: http://blog.csdn.net/jingwenlai_scut/article/details/ 5642348c++ and Python mixed programming-C + + write Python extension: http://tanklee.github.io/2013/11/25/python-cpp-programming-1/

Some understandings of Python embedding into C + +

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.