Skip to content

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 Definition

The 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>;
}
  1. This record defines a custom datatype that can be used to transmit data from the host language to C++ und vice-versa.
  2. This interface defines a class with methods that will be implemented in C++ and can be called from the host language.

🎛️Configuration

The 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
  1. A JSON report is generated that lists all input and output files.
  2. The target directory for both header and source files can be specified separately

🔌Modular

Pydjinni is modular. Additional capabilities can be added through custom plugins.

🔧️Toolchain

The tool provides additional utilities to help build, package and distribute cross-platform libraries.

🐍Python API

The 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



  Try Now