No need for a virtual machine

Kotlin/Native v0.3 now supports Windows

Gabriela Motroc

© Shutterstock / Jackson

Kotlin/Native v0.3 is here and the most exciting news is that it adds Windows support. Just a quick reminder: Making arbitrary Kotlin/JVM programs runnable on Kotlin/Native or Kotlin/JS is *not* what JetBrains aims to achieve, though — making Kotlin usable throughout a modern application is.

Habemus Windows support! Kotlin/Native v0.3 has just been released and the best part is that Windows is supported as both a compilation host and execution target, and Google Android devices as an execution target with native activities.

Windows API ‘Hello World’

import win32.*
fun main(args: Array<String>) {
  MessageBoxW(null, "Привет!","标题", MB_YESNOCANCEL or MB_ICONQUESTION)

With this release, JetBrains also supports source level debugging (single-stepping only) and there’s a new library format, called .klib, which is intended to be the default distribution format for Kotlin/Native libraries. Nikolay Igotti, Kotlin/Native Tech Lead, explained in the blog post announcing the new version that “native libraries and frameworks could be easily interoperated with using .klib and used with Kotlin/Native compiler by just specifying -library library command line flag or library Gradle plugin option. Interop tool already produces .klib format files by default.”

For more details about Kotlin/Native v0.3 check out the Kotlin blog.


Update April 7, 2017

JetBrains’ Andrey Breslav recently announced the availability of the first Technology Preview of Kotlin/Native which compiles Kotlin directly to machine code — so there’s no need for a virtual machine. Although it is not a fully functional release yet, users can now play with the technology and look at its source code.

The compiler is available under the Apache 2 OSS license.

What is Kotlin/Native?

Kotlin/Native is a LLVM backend for the Kotlin compiler, runtime implementation and native code generation facility using LLVM toolchain. It is mainly designed to allow compilation for platforms where virtual machines are not desirable or possible (such as iOS, embedded targets), or where the developer is willing to produce a reasonably-sized self-contained program without the need to ship an additional execution runtime.

Breslav explained that Kotlin/Native is “another step toward making Kotlin usable throughout a modern application. Eventually, it will be possible to use Kotlin to write every component, from the server back-end to the web or mobile clients.”

Sharing the skill set is one big motivation for this scenario. Another is sharing actual code.

JetBrains’ vision for inter-platform code reuse is to allow users to write entire modules in Kotlin in a platform-independent way and compile them for any supported platform (currently these are Kotlin/JVM, Kotlin/JS and the upcoming Kotlin/Native). These are called common modules. Breslav warned that parts of a common module might require a platform-specific implementation [which can be developed individually for each platform]. He also revealed that they offer a common API for all clients, but other (platform-specific) modules can extend this API to provide some exclusive capabilities on their platform.

JetBrains aims to provide a common language for all platforms while enabling the creation of common libraries through seamless interoperability with platform code, Breslav added.

Tech preview overview

In this technology preview, the following target platforms are supported:

  • Mac OS X 10.10 and later (x86-64)
  • x86-64 Ubuntu Linux (14.04, 16.04 and later), other Linux flavors may work as well
  • Apple iOS (arm64), cross-compiled on MacOS X host
  • Raspberry Pi, cross-compiled on Linux host

More platforms can be added quite easily, as long as the LLVM support is available for them. A few more platforms will probably be supported out-of-the-box in the future, Breslav revealed.


This Technology Preview has a number of limitations that will be eliminated at later stages:

  • No performance optimization has been done yet, so benchmarking Kotlin/Native makes no sense at this point.
  • The Standard Library and reflection support are far from complete, more APIs will be added later.

Read more in the Release Notes.

Gabriela Motroc
Gabriela Motroc was editor of and JAX Magazine. Before working at Software & Support Media Group, she studied International Communication Management at the Hague University of Applied Sciences.

Inline Feedbacks
View all comments