•  

Integrating Python and C++ with Boost.Python

A session at PyCon UK 2014

Friday 19th September, 2014

4:20pm to 6:20pm (GMT)

Python and C++ are both popular languages that each bring a lot to the table. The languages also complement one another well: Python is high-level, dynamic, and easy to use while C++ is at-the-metal, static, and (in)famously tricky. There are times when there are real advantages to combining these disparate natures, and Python’s C API provides a strong interface for doing just that. Boost.Python is a C++ library that builds upon and improves Python’s C API to give users a simpler, more intuitive, and safer means to integrate Python and C++.

In this talk we’ll look at how to use Boost.Python to effectively bridge the Python/C++ boundary. We’ll start by briefly looking at the fundamentals of the Python C API since that defines the “ground rules”; this includes things like reference counting, the basic object model, and so forth. We’ll then take a look at the Boost.Python API and show how it provides the same functionality as the underlying C API, but does so in a way that doesn’t obscure the real semantics of the Python language.

Specific topics in this talk will include:
* Exposing classes across the language boundary
* Proper exception handling techniques
* Module initialization
* Packaging and code structure
* Debugging and profiling
* Negotiating the very different type system
* Compilation and linking requirements

We’ll look at using Boost.Python for both extending Python (using C++ code in Python) and embedding it (using Python code from C++.) Audience members will learn enough to do fairly sophisticated Python/C++ integration right away, they’ll see how easy it is to use Python rather than “greenspunning” their own language, and they’ll get the orientation they need in order to learn the rest of what there is to know.

About the speaker

This person is speaking at this event.
Austin Bingham

Technical Director, Sixty North AS

Coverage of this session

Sign in to add slides, notes or videos to this session

PyCon UK 2014

England England, Coventry

19th22nd September 2014

Tell your friends!

When

Time 4:20pm6:20pm GMT

Date Fri 19th September 2014

Short URL

lanyrd.com/sddffy

Official event site

www.pyconuk.org

View the schedule

Share

See something wrong?

Report an issue with this session