PyDjinni
The C++ Cross-Platform Library
Development Toolkit.
PyDjinni is a tool for generating cross-language type declarations and interface bindings.
Heavily inspired by the original Djinni by Dropbox, it's designed to connect C++ with Java, Objective-C and C#.
¶
Interface DefinitionThe interface to C++ is defined with a custom interface definition language.
person = record { # (1)!
id: i16;
name: str;
age: i16;
}
database = main interface +cpp { # (2)!
add(person: person) -> bool;
remove(person: person) -> bool;
get_persons() -> list<person>;
}
- This
record
defines a custom datatype that can be used to transmit data from the host language to C++ und vice-versa. - This
interface
defines a class with methods that will be implemented in C++ and can be called from the host language.
¶
ConfigurationThe output can be configured with a YAML configuration file.
generate:
list_processed_files: processed-files.json # (1)!
cpp:
out:
header: out/include # (2)!
source: out/src
namespace: my::lib
java:
out: out/java
jni:
out: out/jni
- A JSON report is generated that lists all input and output files.
- The target directory for both header and source files can be specified separately
¶
ModularPydjinni is modular. Additional capabilities can be added through custom plugins.
¶
ToolchainThe tool provides additional utilities to help build, package and distribute cross-platform libraries.
¶
Python APIThe tool can also be used through a Python API, in order to seamlessly embed into a custom build process.
Roadmap¶
PyDjinni is written completely from scratch and still has some rough edges.
Here is what is planned for the near future:
- Publish initial preview
- Add C#/Windows support
- Add language server (LSP) support
- Publish IDE plugins
- Add project setup wizard
- Add seamless async (coroutine) interaction
- Add advanced exception translation
- Increase test coverage
- Add properties support
- Add code documentation generator
- Release stable version 1.0