Scala Native

Releases[1]

Type

Version

Stable

0.5.10

Latest

0.5.11-20260216-ddbba57-SNAPSHOT

Scala Native is an optimizing ahead-of-time compiler and lightweight managedruntime designed specifically for Scala. It features:

  • Low-level primitives.

    importscala.scalanative.unsafe._typeVec=CStruct3[Double,Double,Double]defsum(vec:Ptr[Vec]):Double=returnvec._1+vec._2+vec._3@maindefmain():Unit=valvec=stackalloc[Vec]()// allocate c struct on stackvec._1=10.0// initialize fieldsvec._2=20.0vec._3=30.0println(sum(vec))// pass by reference

    Pointers, structs, you name it. Low-level primitiveslet you hand-tune your application to make it workexactly as you want it to. You’re in control.

  • Seamless interop with native code.

    importscala.scalanative.unsafe._importscala.scalanative.unsigned._@externobjectstdlib{defmalloc(size:CSize):Ptr[Byte]=extern}valptr=stdlib.malloc(32.toCSize)

    Calling C code has never been easier.With the help of extern objects you canseamlessly call native code without anyruntime overhead.

  • Instant startup time.

    > time hello-nativehello, native!real    0m0.005suser    0m0.002ssys     0m0.002s

    Scala Native is compiled ahead-of-time via LLVM.This means that there is no sluggish warm-upphase that’s common for just-in-time compilers.Your code is immediately fast and ready for action.

Community

Documentation

This documentation is divided intodifferent parts. It’s recommended to go through theUser’s Guide to get familiarwith Scala Native.Libraries will walk you through all the known libraries thatare currently available.Contributor’s Guide contains valuable information for peoplewho want to either contribute to the project or learn more about the internalsand the development process behind the project.

[1]

SeeRelease types

Document built at : 2026-02-16