CppCon 2016 has ended
Tuesday, September 20 • 3:45pm - 4:15pm
Python & C++: the Beauty and the Beast, dancing together. Introduction to C++ python extensions and embedding Python in C++ Apps.

Log in to save this to your schedule, view media, leave feedback and see who's attending!

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.

avatar for Diego Rodriguez-Losada Gonzalez

Diego Rodriguez-Losada Gonzalez

Lead Architect, JFrog
Diego Rodriguez-Losada‘s passions are robotics and SW engineering and development. He has developed many years in C and C++ in the Industrial, Robotics and AI fields. Diego was also a University (tenure track) professor and robotics researcher for 8 years, till 2012, when he quit... Read More →

Tuesday September 20, 2016 3:45pm - 4:15pm PDT
Vanity (Room 404) Meydenbauer Center