Skip to content

Commit

Permalink
called C code from Rust!
Browse files Browse the repository at this point in the history
  • Loading branch information
lquenti committed Feb 22, 2024
1 parent e9dca70 commit c132139
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion blackheap-benchmarker/src/c_code/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::ffi::CString;

use benchmarker::{access_pattern_ACCESS_PATTERN_SEQUENTIAL, benchmark_config, error_codes_ERROR_CODES_SUCCESS};

fn run_benchmark() {
pub fn run_benchmark() {
let filepath = CString::new("/tmp/test_file.bin").expect("CString::new failed");
let config = benchmark_config {
filepath: filepath.as_ptr(),
Expand Down
3 changes: 3 additions & 0 deletions blackheap-benchmarker/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
mod c_code;

// debug
pub use c_code::run_benchmark;
1 change: 1 addition & 0 deletions blackheap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ authors = ["Lars Quentin <[email protected]>"]
readme = "./README.md"

[dependencies]
blackheap-benchmarker = { path = "../blackheap-benchmarker" }
2 changes: 1 addition & 1 deletion blackheap/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
println!("Hello, world!");
blackheap_benchmarker::run_benchmark();
}

#[cfg(test)]
Expand Down

0 comments on commit c132139

Please sign in to comment.