Slinc: A Library for Scala to C Interoperability
summary
Slinc provides Scala-to-C bindings built with Scala 3 metaprogramming, the Java Panama/Foreign API (Java 17/19), and a runtime multi-stage JIT. It exposes ergonomic traits for C functions and structs, pointer.copy/scopes for native heap access, varargs support for C variadic calls, and platform-dependent C types (e.g. C long) so bindings are safe across Linux, macOS and Windows. Runtime JIT compiles hot paths after ~10,000 calls, yielding ~20–30x faster code than the generic generated version and ~80% of handwritten native-call speed.
AI-written summary · about
chapters (19)
- 0:00Intro
- 0:49Platforms
- 1:33The problem
- 1:56Native Interoperability for Java
- 2:29Slinc's niche
- 3:19Slinc is Scala 3 exclusive
- 3:53rand binding
- 6:12Memory
- 7:55Ptr Mutation
- 9:36C Strings
- 11:06Passing args
- 12:43sprintf binding
- 15:16Java 19
- 17:18Multiplatform
- 20:17Foreign mem writer
- 21:29Jit Compilation
- 22:08JIT generated writer
- 22:57Performance comparison
- 24:00Singleshot comparison
related talks
40mScala Goes Native
30mScala Native: the marriage of performance and functional comfort
42mScala goes Native
19mHow to use a Rust library inside the JVM application
56mGet the best of both worlds: Integrating Rust with other languages
40m"Fine-Grained C++ Interop"
31mStatically-Compiled Julia for Library Development
41mUsing Clojure with C APIs for crypto and more
