Hi folks, I've been using a derived version of s7 for months to build some tools for dealing with OCaml builds. I decided to polish it up a little and make it available as an independent package <https://github.com/obazl/libs7>. It's basically the same as s7, but with a Bazel build program and a little reorganization. Bazel has excellent test facilities and works with multiple languages, so if you need to integrate s7 with other languages (python, rust, go, etc.) you might find libs7 worth a look.
The main difference is replacement of the cload mechanism by a derived version, clibgen, that only generates C files, which are compiled and linked at build-time. The build program supports three linking strategies: build and link archive files at build-time; build shared libs and link them at build-time; and build shared libs and link/load them at runtime using dload. Initialization is handled by a single function, libs7_load_clib (Scheme version: load-clib) that takes a single arg (the libname) and works with all three link strategies. For example there are three ways to run the repl: bazel run repl --//config/clibs/link=archive (the default, so you can do just 'bazel run repl') bazel run repl --//config/clibs/link=shared bazel run repl --//config/clibs/link=runtime In all three cases you can then do something like (load-clib 'gdbm). The Scheme APIs for clibs use colon-namespaces, e.g. (gdbm:version), (libc:isalpha 65), etc. I've added a new clib, cwalk <https://github.com/likle/cwalk>, for manipulating path strings. For example (cwk:path-normalize "a/b/..c") => "a/c". All C library dependencies are built; there is no reliance on system-installed libs. So for example the gdbm bindings are in libgdbm_s7.c, which is generated from libgdbm_clibgen.scm; it depends on libgdbm, which will be downloaded and built when you build libgdbm_s7. The downside of this is that the initial build may take quite a while. If you depend on libarb, you'll have to wait while Bazel builds libgmp, libflint, libmpfr, and libarb. libgsl also takes a while to build. So the default config for the test and repl targets does not depend on those. The upside is that your builds will be mostly hermetic, and you'll never have to deal with lib versioning clashes or worry about non-standard installation locations of clib deps. I've also added a testsuite using the Unity <https://www.throwtheswitch.org/unity> framework. It works very well with s7. I don't have a lot of test cases, but there are enough to verify that the clib bindings are in working order. More details are available in the README at libs7 <https://github.com/obazl/libs7>. Feedback welcome. Gregg
_______________________________________________ Cmdist mailing list [email protected] https://cm-mail.stanford.edu/mailman/listinfo/cmdist
