Clojure binding to rift — copy-on-write development workspaces, a faster
alternative to git worktree — via the native librift_ffi shared library
loaded in-process through the JDK Foreign Function & Memory API
(java.lang.foreign, stable since JDK 22).
The native ABI is exactly two C symbols, JSON in / JSON out:
char* rift_ffi_call(const char* json_request) ;; heap-allocated reply void rift_ffi_free(char* reply)
A request is {"command" "create" ...}; a reply is either
{"status" "ok" "value" ...} or
{"status" "error" "error" {"code" .. "message" .. "path" ..}}.
We bundle the prebuilt library for every supported platform under
resources/prebuilds/<os>-<arch>/, extract the matching one to a temp file
at first use (you cannot dlopen from inside a jar), open it, and bind the
two symbols. The library is mapped for the lifetime of the process.
Supported platforms: darwin-arm64, darwin-x64, linux-x64, linux-arm64.
REQUIRES the JVM flag --enable-native-access=ALL-UNNAMED; without it the
first native call prints a restricted-method warning (and on a future JDK
default of --illegal-native-access=deny would fail outright).
Clojure binding to rift — copy-on-write development workspaces, a faster
alternative to `git worktree` — via the native `librift_ffi` shared library
loaded in-process through the JDK Foreign Function & Memory API
(`java.lang.foreign`, stable since JDK 22).
The native ABI is exactly two C symbols, JSON in / JSON out:
char* rift_ffi_call(const char* json_request) ;; heap-allocated reply
void rift_ffi_free(char* reply)
A request is `{"command" "create" ...}`; a reply is either
`{"status" "ok" "value" ...}` or
`{"status" "error" "error" {"code" .. "message" .. "path" ..}}`.
We bundle the prebuilt library for every supported platform under
`resources/prebuilds/<os>-<arch>/`, extract the matching one to a temp file
at first use (you cannot `dlopen` from inside a jar), open it, and bind the
two symbols. The library is mapped for the lifetime of the process.
Supported platforms: darwin-arm64, darwin-x64, linux-x64, linux-arm64.
REQUIRES the JVM flag `--enable-native-access=ALL-UNNAMED`; without it the
first native call prints a restricted-method warning (and on a future JDK
default of `--illegal-native-access=deny` would fail outright).cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |