0.4.11 (2023-03-15)

We’re happy to announce the release of Scala Native. It’s the next maintenance release for Scala Native 0.4.x. As always it brings bug fixes and minor improvements.

Notable changes

Extern methods with a variadic number of arguments

For a long time, Scala Native supported C va_list using scalanative.unsafe.CVarArgList. This allowed for interop with some of the C functions taking the variadic number of arguments. This release makes usage and definition of them easier, by restoring support for idiomatic ways of passing them using Scala variadic arguments lists.

void printf(char* format, ...);
@extern def printf(format: CString, args: Any*): Unit = extern

@main def test() = 
    val msg = c"MyMessage"
    printf("String '%s' is allocated at %p and has %d characters\n", msg, msg, strlen(msg))

Support for LLVM 15

The latest versions of LLVM added a new internal representation of pointers - their opaque variant replaces typed pointers. This change should not affect most of the users, but in some specific builds it could have lead to linking issues. Now Scala Native will try to detect version of LLVM toolchain. When using LLVM 15 or newer Scala Native toolchain would always generate opaque pointers in the compiled LLVM IR.

The Scala standard library used by this release is based on the following versions:

Scala binary version Scala release
2.12 2.12.17
2.13 2.13.10
3 3.2.2
Commits since last release 43
Merged PRs 40
Contributors 6


Big thanks to everybody who contributed to this release or reported an issue!

$ git shortlog -sn --no-merges v0.4.10..v0.4.11
    24	Wojciech Mazur
    14	LeeTibbert
     2	Arman Bilge
     1  João Costa
     1  Ondra Pelech
     1  philwalk

Merged PRs


Full Changelog

Merged pull requests:

Java Standard Library

  • Partial Fix #3090: j.nio.MappedByteBuffer no longer causes segmentation fault on FreeBSD64 #3113 (LeeTibbert)
  • Port all missing java.util.function types #3127 (WojciechMazur)
  • Fix #3131: javalib ServerSocket should now be more accepting #3140 (LeeTibbert)
  • Fix #3153: j.nio.fs.FileHelpers uses only java.io.tmp property for temporary files/dirs #3155 (LeeTibbert)
  • Fix #3071, #3135: Implement Java 11 writeString & readString methods and Java 10 transferTo #3159 (LeeTibbert)
  • Fix #2937, 3163: improved j.nio.f.Files default directory idiom handling #3166 (LeeTibbert)
  • Partial fix #3165: Port two JSR-166 concurrent interfaces/traits: BlockingDeque, TransferQueue #3188 (LeeTibbert)
  • Fix #3192. #3194: Implement limited java spliterator support #3202 (LeeTibbert)
  • javalib Spliterators trySplit() methods now split #3218 (LeeTibbert)

POSIX bindings

  • posixlib socket.c now compiles on FreeBSD arm64 #3112 (LeeTibbert)
  • Fix #1642: posixlib stdio.scala is now mostly Open Group 2018 compliant #3160 (LeeTibbert)
  • Fix #3206: posixlib unistd and monetary use new CVarArgs support #3209 (LeeTibbert)

Compiler plugin



sbt plugin