scala-native / scala-native-bindgen

Scala Native Binding Generator

Home Page:https://scala-native.github.io/scala-native-bindgen/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add initial bindings subproject

jonas opened this issue · comments

Add initial sbt project with generated bindings and tests for those bindings.

A possible candidate is bzip2 (https://rust-lang-nursery.github.io/rust-bindgen/tutorial-0.html) which should live under bindings/bzip2.

The goal is for the initial bindings to serve as a template for future contributions. As such, steps to contribute new bindings should also be documented.

I initially looked into adding bzip2, but there are currently issues with handling methods wrapped in macros. I didn't investigate whether we need to explicitly enable macro expansion in order to load the code correctly or whether the issue is with the use of extern.

#   define BZ_API(func) func
#   define BZ_EXTERN extern

BZ_EXTERN int BZ_API(BZ2_bzCompress) (
      bz_stream* strm,
      int action
   );

Instead I suggest we use getopt.h for the initial binding. It, however, uses extern variable declarations. Created #70 as a dependency.