Djinni is a tool for generating cross-language type declarations and interface bindings. It's designed to connect C++ with either Java or Objective-C.
We at Dropbox use Djinni to interface cross-platform C++ library code with platform-specific Java and Objective-C on Android and iOS.
We announced Djinni at CppCon 2014. See the slides here: https://bit.ly/djinnitalk Video coming soon!
- Generates parallel C++, Java and Objective-C type definitions from a single interface description file.
- Supports the intersection of the three core languages' primitive types, and user-defined enums, records, and interfaces.
- Generates interface code allowing bidirectional calls between C++ and Java (with JNI) or Objective-C (with Objective-C++).
- Can autogenerate comparator functions (equality, ordering) on data types.
Dropbox's CppCon talk slides explain more details, including that Dropbox is using C++ not for "legacy" reasons. Rather, Dropbox is "building (mostly) new apps. Not dealing with lots of legacy code. Not dealing with (very) old platforms. We're building multiple apps." And the language of choice for having a single source code base that can target iOS, Android, OS X, Linux, and Windows is... C++. Their approach is to use C++ for the common code, and a thin bridge (via Djinni) to the Java-specific code on Android, the Objective-C-specific code on iOS, and so on.
A full video of the presentation will be available in approximately one month.