Hi! I’m currently working on Android, on a project that has a native C++ side, and I’m using Kotlin instead of Java. I’m binding the code with the
external keyword and the usual Java style means. Based on my past experience in similar projects (where i used swig to bind Java and C++), it would be of great advantage if Kotlin would give a way of doing the binding for C++.
The Java way, has the advantage that is simple to build for the language developers, but it’s cumbersome especially for application developers that want to use it for binding C++ code.
What SWIG does is to build a twin object of a C++ object on the Java side. It builds also two inner layers (one on Java and the other on c++), because JNI was thought to work with C. This means that intermediate objects are necessary to link functions from Java to static functions on the C side.
would be cool if you could tag a kotlin class and have generated a twin class in c++ that you could use as if it was the original kotlin class, and ideally (in the dream world) tag a c++ class and have a correspondent kotlin class generated.
I know it’s probably crazy, but that would put Java JNI in the stone age.