The Complete Magazine on Open Source

Google develops a framework to bring C++ closer to Python

8.49K 0

CLIF to offer C++ to Python language binding

Google has built an intrinsic open source project to let developers create C++ wrapper generators for Python. Called CLIF, the new framework automatically generates C++ library bindings for multiple languages though initially supports Python 2 and 3.

CLIF consists of four different parts, namely parser, matcher, generator and runtime. It leverages the LLVM compiler framework to converts a language-friendly C++ API description into the language-agnostic internal format. For collecting any typed information, the framework parses selected C++ headers with Clang.

Apart from parsing and matching the typed data, CLIF is capable of emitting C++ source code for a wrapper by using its generator component. The same wrapper is then used in the runtime to perform type conversions.

Become smarter over time

Google has provided elements such as its protobuf (for inter-process communication between the CLIF front-end and back-end) and the CMake build system. Going forward, the framework is likely to become smarter with features such as inheritance. A feature to map exceptions in two languages is also expected to be added in a later version.

In the meantime, you can access the CLIF code from a GitHub repository. The online listing explicitly mentions that the project has no formal link with Google.