C++ bindings generator for various languages
Project description
Introduction
CppBind is a software development tool that automates language bindings generation between C++ and other languages. It works by annotating C++ code to indicate parts desired to expose to all supported target languages. The current version of the tool supports bindings with Swift, Kotlin, and Python, while support for new languages can be added relatively easily.
Manually developing bindings is complex, time-consuming, and error-prone, especially for large-scale projects requiring frequent changes. To develop manual bindings, one should be knowledgeable in both C++ and the target language to implement types serialization from one language to another, function and method mapping, and more. To overcome these challenges, we introduce CppBind.
CppBind main highlights:
- Generates binding wrappers for multiple languages (Python, Swift, and Kotlin);
- Allows using language-agnostic annotations for all supported languages;
- Supports a rich set of C++ features;
- Provides the ability to add support for other languages;
- Can be used to generate bindings for third-party C++ libraries.
Features
CppBind generates bindings for C++ types and entities like classes, methods, global functions, enums, nested structures, templates, etc. The list of the main features of CppBind is following:
- Functions
- OOP
- Classes and structs
- Nested types
- C++ classes/structs as target language interfaces
- Enumerations
- Inheritance
- Object type preservation
- Static methods
- Method overloading
- Converting getters/setters to target language properties
- Operator overloading
- Templates
- Exception handling
- Standard library types (std::shared_ptr, std::vector, std::map, etc.)
- Custom type conversions
- Intelligent code completion
Usage
CppBind instructions are controlled using annotations. There are two prominent use cases for annotating C++ source files: either you are the source code owner, or it's from a third-party/standard library. CppBind annotations are specified directly in the source files in the first case. In the second case, separate config files can be used. The second use case works well for binding third-party C++ libraries.
- To configure a project with self-owned files, you can read our "Hello User" tutorial.
- To configure a project with third-party/standard library files, you can read our "Array" tutorial.
Above-described usages can also be mixed: annotations for self-owned files are written inside those files, while third-party/standard library files are annotated via separate config files.
Installation
There are some required steps to install and use CppBind. The installation steps are described here.
License
CppBind is provided under the MIT license that can be found in the LICENSE file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.
How to contribute to CppBind?
If you like CppBind and would like to contribute to this open-source project, please check the Contribution guide.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cppbind-1.0.3.tar.gz
.
File metadata
- Download URL: cppbind-1.0.3.tar.gz
- Upload date:
- Size: 160.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d285380dc5747860b36022cb8e5f62223812347ce899b8bdd32cb312371e8cf4 |
|
MD5 | 6198a9b13357b0e935917ea21412c3b1 |
|
BLAKE2b-256 | b6d0298f85e1bcf0c0e925a7dad6cd9da70dc867384798d68ada1746681fb7c4 |
File details
Details for the file cppbind-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: cppbind-1.0.3-py3-none-any.whl
- Upload date:
- Size: 188.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f7c284dcefaaca17d763783a59b4aa7a8d2d964dde3268267ffe708a7e3854 |
|
MD5 | 92ceed10bb06c076b16866b9a3d92b21 |
|
BLAKE2b-256 | 7063f86b7f7b5b8d4f5df39c26c9f049bfce31f2ab0b65a02b71db0c246b8d31 |