Kotlin/Native for Native
Kotlin/Native is a technology for compiling Kotlin code to native binaries, which can run without a virtual machine. It is an LLVM based backend for the Kotlin compiler and native implementation of the Kotlin standard library.
Kotlin/Native is primarily designed to allow compilation for platforms where virtual machines are not desirable or possible, for example, embedded devices or iOS. It solves the situations when a developer needs to produce a self-contained program that does not require an additional runtime or virtual machine.
Target Platforms
- iOS (arm32, arm64, simulator x86_64)
- macOS (x86_64)
- watchOS (arm32, arm64, x86)
- Android (arm32, arm64, x86, x86_64)
- Windows (mingw x86_64, x86)
- Linux (x86_64, arm32, arm64, MIPS, MIPS little endian)
- WebAssembly (wasm32)
Kotlin/Native supports two-way interoperability with the Native world. On the one hand, the compiler creates:
- an executable for many platforms
- a static library or library with C headers for C/C++ projects
- an Apple framework for Swift and Objective-C projects
On the other hand, Kotlin/Native supports interoperability to use existing libraries directly from Kotlin/Native:
- static or dynamic
- C, Swift, and Objective-C frameworks
Kotlin/Native help to share Kotlin code between projects. POSIX, gzip, OpenGL, Metal, Foundation, and many other popular libraries and Apple frameworks are pre-imported and included as Kotlin/Native libraries into the compiler package.
Sharing Code between Platforms
allow sharing common Kotlin code between multiple platforms, including Android, iOS, JVM, JavaScript, and native. Multiplatform libraries provide required APIs for the common Kotlin code and help develop shared parts of a project in Kotlin code in one place and share it with all or several target platforms.
New to Kotlin? Take a look at the Getting Started page.