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

sys ocaml-boxroot-sys

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

7 unstable releases

new 0.4.0 Feb 5, 2025
0.4.0-rc1 Jan 16, 2025
0.3.1 Mar 12, 2024
0.3.0 Feb 9, 2023
0.1.0 Mar 11, 2021

#159 in Memory management

Download history 11479/week @ 2024-10-22 13118/week @ 2024-10-29 16050/week @ 2024-11-05 14142/week @ 2024-11-12 16144/week @ 2024-11-19 11834/week @ 2024-11-26 17739/week @ 2024-12-03 17360/week @ 2024-12-10 15893/week @ 2024-12-17 8844/week @ 2024-12-24 10850/week @ 2024-12-31 17480/week @ 2025-01-07 18927/week @ 2025-01-14 17740/week @ 2025-01-21 16072/week @ 2025-01-28 13458/week @ 2025-02-04

70,897 downloads per month
Used in 4 crates (2 directly)

MIT license

62KB
1.5K SLoC

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

Boxroot for OCaml: fast movable GC roots

News

OCaml ≥ 5.3 requires Boxroot 0.4.

Change log: https://gitlab.com/ocaml-rust/ocaml-boxroot/-/blob/main/Changes.md.

Description

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.

Dependencies

~0–305KB