Skip to content

coreyoconnor/sn-bindgen

 
 

Repository files navigation

Bindings generator for Scala 3 Native

Distributed as a SBT plugin and a CLI program, this project generates idiomatic Scala 3 Native bindings to C libraries.

Status (February 2023): project is actively maintained, CLI interface is considered more stable than the interface in build tool plugins, but both aren't guaranteed to not change until v0.1.0

  • Generates glue C code to work around Scala Native's missing interop features
  • Strongly typed (where possible) interfaces to structs, unions, and functions
  • Supports named enums
  • Collects unnamed enums into a single location
  • Extra flags to work around compiler deficiencies

2023-02-07 13 48 03

FAQ:

  • Generated bindings do not run on the JVM, only on Scala Native

  • In cases where Scala Native cannot encode certain C idioms, glue C code is generated

  • The generator itself is implemented in Scala 3 Native with some C glue code to libclang

  • Only C header files are supported

  • Due to lack of Apple M1 runners, I am not able to build binaries for that platform. For local work, you can checkout the repo at the version you want and run

    $ sbt devPublish
    

    Which will build the binary for your platform and publish it locally

About

Scala 3 native binding generator + libclang facade

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 93.5%
  • C 6.4%
  • Shell 0.1%