Compiling to Other Targets

In addition to all the capabilities that Kotlin offers, it’s one of the few languages that can be compiled to different targets.

  • On Android devices: Kotlin is considered a first-class language for Android development. We’ll explore using Kotlin to create Android applications in Chapter 20, Writing Android Applications with Kotlin.

  • To JavaScript: transpilation is compiling from the source code of one language to the source code of another language. You can see how to transpile Kotlin to JavaScript in Appendix 1, Transpiling to JavaScript.

  • To native targets: when compiling down to a virtual machine isn’t an option, Kotlin/Native can be used to compile your source code to different native targets like iOS, Linux, MacOS, Windows, and others, and can be executed without a virtual machine. See Appendix 2, Kotlin/Native, for an introduction to using Kotlin/Native.

  • To WebAssembly to run in browsers: using Kotlin/Native, you may also compile Kotlin source code to WebAssembly or Wasm,[15] which is a binary format for virtual machines that run within modern browsers. In Appendix 3, Kotlin to WebAssembly, we’ll explore this capability to create Kotlin code that runs within browsers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset