Kotlin JVM Easy JNI using SWIG and Gradle CPP

Submitted by Dickens A S on Sat, 08/22/2020 - 15:34

This article demonstrates easy way of generating C++ stub code including Java Generation for the corresponding C++ Classes using SWIG

The Gradle KTS project contains a sub module which contains the main source code, the header file and the SWIG file

The Gradle KTS is written in such way it will call the "swig" command line and generates the wrappers and copies the files to corresponding locations

The C++ compiler is auto chosen by Gradle cpp-library plugin, there is no need to write CMake or MakeFile or batch files for that

Kotlin Web Assembly WebGL Auto Stub

Submitted by Dickens A S on Sat, 05/02/2020 - 05:37

WebGLRenderingContext is a big API, it has 200+ properties and 100+ methods, writing a JavaScript stub and corresponding Kotlin stub is very difficult 

We need to write 1400+ lines of JavaScript code and 3000+ lines Kotlin code

This Kotlin gradle script provides a simple approach to auto generate the stub and also compile the generated code to .klib

Gradle Stub Code in KTS

Kickstart kotlin code and run in browser using CDN

Submitted by Dickens A S on Fri, 11/01/2019 - 13:57

Easily create kotlin project from these boilerplate Gradle DSL  Run in browser without additional JS packaging scripts

the Kotlin dependency is added in browser using below CDN

<script src=""></script>

Source code available in GitHub