Wednesday 1:10 p.m.–1:45 p.m.

Python with a SWIG of C++

Bob McNaughton

Audience level:
Intermediate

Description

Despite the many advantages Python has over more traditional languages such as C++, sometimes C++ is the only option available. For example, when a legacy API must be used, or a particular task can be performed more efficiently in C++. SWIG is a tool that lets you automate the generation of interfaces to existing C++ code, for use by other languages, including Python.

Abstract

SWIG is a tool that can take an existing Linux .so or Windows .dll library, the associated header files, and a custom written SWIG interface file, and generate something that can be imported into Python.

This talk will start with the case of writing a simple C function, with standard types for parameters and return values, with the goal of calling it from Python using SWIG in mind. It will then move to using C++ and more complex types, and then to libraries that you may not have the source code for, such as a commercial library from a third party vendor.

Sponsors


Become a sponsor.