#ocaml #foreign-interface #ffi #smart-pointers #rust

sys ocaml-boxroot-sys

Boxroot for OCaml: fast movable GC roots (C API)

5 unstable releases

0.3.1 Mar 12, 2024
0.3.0 Feb 9, 2023
0.3.0-rc.1 Feb 3, 2023
0.2.0 Mar 18, 2021
0.1.0 Mar 11, 2021

#164 in Memory management

Download history 13242/week @ 2024-06-17 14144/week @ 2024-06-24 7649/week @ 2024-07-01 11461/week @ 2024-07-08 12295/week @ 2024-07-15 15128/week @ 2024-07-22 15744/week @ 2024-07-29 12980/week @ 2024-08-05 15955/week @ 2024-08-12 15145/week @ 2024-08-19 13202/week @ 2024-08-26 13495/week @ 2024-09-02 14783/week @ 2024-09-09 16067/week @ 2024-09-16 12491/week @ 2024-09-23 12172/week @ 2024-09-30

57,097 downloads per month
Used in 4 crates (2 directly)

MIT license

53KB
1K SLoC

C 1K SLoC // 0.2% comments Rust 148 SLoC // 0.1% comments

Boxroot for OCaml: fast movable GC roots

This library extends the OCaml foreign function interface with an efficient and flexible GC rooting mechanism. See https://gitlab.com/ocaml-rust/ocaml-boxroot/.

This crate exposes the raw functionality of the Boxroot library as unsafe Rust functions. It is meant to be used by low-level libraries to expose GC roots for the OCaml GC as smart pointers in Rust (see the crate ocaml-interop).

Running tests

The link-ocaml-runtime-and-dummy-program feature needs to be enabled when running tests:

cargo test --features "link-ocaml-runtime-and-dummy-program"

Feature flags

bundle-boxroot

If this feature flag is not enabled (by default it is enabled), the compilation of the C code that implements boxroot will be skipped, and the user is responsible of linking boxroot into the final binary.

When this feature flag is enabled, the OCaml headers must be available to be able to compile the boxroot C code.


lib.rs:

The documentation of the functions can be found inside boxroot/boxroot.h (including rules for safe usage)

Dependencies

~225KB