Kotlin compiles directly to native code via LLVM

April 4, 2017 brianradio2016 No comments exist

Kotlin, the JVM-based language from IDE maker JetBrains, can now be compiled to standalone executables using the newly unveiled Kotlin/Native compiler.

The compiler uses the LLVM project to generate the executables—another example of LLVM as the premier tool to both enable new languages and enhance existing ones.

Go native, go faster

In its current pre-release form, Kotlin/Native produces binaries for MacOS 10.0 and greater, Ubuntu Linux 14.04 and greater, iOS, and Raspberry Pi. Microsoft Windows is not yet supported, due to “significant difference[s] in exception handling model on MS Windows and other LLVM targets,” but “this situation could be improved in upcoming releases,” JetBrains says. Many other features, like coroutines (recently introduced for Kotlin and LLVM), aren’t available yet.

One heavily touted Kotlin/Native feature, even at this early point in its development, is interoperability with C functions. C variable types are all supported with Kotlin counterparts, and you can automatically generate bindings from any C header at build time. With a language that compiles to a platform-native binary, working with C seems a must, given that C is one of the few languages that exists on almost every hardware platform.

Leave a Reply

Your email address will not be published. Required fields are marked *