filmov
tv
CppCon 2016: “Introduction to C++ python extensions and embedding Python in C++ Apps'

Показать описание
—
—
C and C++ languages are the best for high performance, and probably have the largest quota among programming languages, implementing the backbone of all of the existing computing infrastructure, including those other programming languages. On the other hand, python usage is also very popular and growing, with its amazing simplicity, and it is being adopted as the generic language for learning and many other tasks ranging from BigData and systems to web sites. Python is also being widely used in development and systems automation “devops”, being the language of choice for many scripting tasks (build systems as SCons are written in python) or as glue between subsystems.
This talk will introduce how both C++ and Python languages can work together. As many of the methods to write python extensions typically use a raw C API, we’ll focus on how to use C++ in such extensions, and the C++ code itself.
First, I’ll briefly present the canonical python C API, and how different aspects of C++ (as Exceptions) have to be handled. Then, I will describe and compare a couple of pure C++ ways to build extensions: the reference Boost.Python and the modern, but very active and popular successor, Pybind11.
Finally, I will conclude explaining how to embed a python interpreter in a C++ application. This allows C++ programs to introduce a powerful and known language to let the users define extensions or configuration of our C++ application without requiring them to build anything.
All presented examples will be complete and working, with build scripts included, in a public repository.
—
Diego Rodriguez-Losada
SW Engineer, Freelance
—
*-----*
*-----*
—
C and C++ languages are the best for high performance, and probably have the largest quota among programming languages, implementing the backbone of all of the existing computing infrastructure, including those other programming languages. On the other hand, python usage is also very popular and growing, with its amazing simplicity, and it is being adopted as the generic language for learning and many other tasks ranging from BigData and systems to web sites. Python is also being widely used in development and systems automation “devops”, being the language of choice for many scripting tasks (build systems as SCons are written in python) or as glue between subsystems.
This talk will introduce how both C++ and Python languages can work together. As many of the methods to write python extensions typically use a raw C API, we’ll focus on how to use C++ in such extensions, and the C++ code itself.
First, I’ll briefly present the canonical python C API, and how different aspects of C++ (as Exceptions) have to be handled. Then, I will describe and compare a couple of pure C++ ways to build extensions: the reference Boost.Python and the modern, but very active and popular successor, Pybind11.
Finally, I will conclude explaining how to embed a python interpreter in a C++ application. This allows C++ programs to introduce a powerful and known language to let the users define extensions or configuration of our C++ application without requiring them to build anything.
All presented examples will be complete and working, with build scripts included, in a public repository.
—
Diego Rodriguez-Losada
SW Engineer, Freelance
—
*-----*
*-----*
Комментарии