Skip to content

util/acct: implement a new hierarchical accounting system #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
build: split rust-lib into rlib & clib
Instead of one static library with all Rust code, split it into two:

1) An rlib Rust library with all Rust code.
2) A staticlib Rust library that links the rlib and provides C stubs.

This split allows us to link the Rust library to other Rust code, like
doctests or unittests. It also keeps the C-API separate from the Rust
code and provides a clean path forward.

Signed-off-by: David Rheinsberg <[email protected]>
  • Loading branch information
dvdhrm committed May 9, 2025
commit 136ffa7f4f303554804cd7e786c80e10afa22f4d
1 change: 1 addition & 0 deletions src/clib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//! # C-Rust Bridge
10 changes: 8 additions & 2 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,18 @@ rust_bus = static_library(
'rbus',
structured_sources(
[
'lib.rs',
'rlib.rs',
],
{
'generated': bindgen_generated,
},
),
)

crust_bus = static_library(
'crbus',
['clib.rs'],
link_with: rust_bus,
rust_abi: 'c',
)

Expand All @@ -155,7 +161,7 @@ static_bus = static_library(
'-fno-common',
],
dependencies: deps_bus,
link_with: rust_bus,
link_with: crust_bus,
pic: true,
)

Expand Down
5 changes: 5 additions & 0 deletions src/lib.rs → src/rlib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
//! most executables of dbus-broker as utility library, relying on link-time
//! garbage collection to drop any unneeded code.

#![no_std]

extern crate alloc;
extern crate core;

/// # Generated Code
///
/// This module exposes all bindgen-generated (or otherwise generated) code,
Expand Down