SN bindgen

Scala 3 Native binding generator to C libraries
HomeConfiguration LimitationsMotivationQuick startSemantics

SBT plugin

bindgenVersion: String

Use this to choose another version of bindgen (by default it matches the plugin version)


Use this to override the path to bindgen binary. By default it's resolved from Sonatype for your particular platform.

bindgenBinary := baseDirectory.value / "my-custom-binary"


Usage: bindgen --package <string> --header <string> [--link-name <string>] [--indentation-size <integer>] [--scala] [--c] [--c-import <string>]... [--clang-include <string>]... [--clang <string>]... [--quiet] [--trace | --info | --warning | --error] [--exclusive-prefix <string>]...

Generate Scala 3 native bindings from C header files

Options and flags:
        Display this help text.
    --package <string>
        Package name (Scala) for generated code
    --header <string>
        C header file with definitions you want bindings for
    --link-name <string>
        Library name for linkage (i.e. 'clang' is equivalent to -lclang flag)
    --indentation-size <integer>
        number of spaces used for indentation (default: 2)
    --base-indentation <integer>
        Base indentation of generated Scala code (default: 0)
        Generate Scala part of the binding
        Generate C part of the binding
    --c-import <string>
        List of C imports to add to generated C file (at the very least you will need the header file for the library itself)
    --clang-include <string>
        List of include paths passed to Clang
    --clang <string>
        List of flags to pass directly to Clang
        Don't output the binding to STDOUT (if you are debugging, for example)
        Output 'trace' log messages or above
        Output 'info' log messages or above
        Output 'warning' log messages or above (this is the default)
        Output 'error' log messages or above
    --exclusive-prefix <string>
        When provided, only definitions that start with this prefix will berendered