From 4a70680d886342f144315ab6f02f1716ec8b50e5 Mon Sep 17 00:00:00 2001 From: Alex Fischman Date: Mon, 25 Mar 2024 10:29:11 -0700 Subject: [PATCH 1/2] Expose the C runtime library to Rust library users --- brilift/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/brilift/src/lib.rs b/brilift/src/lib.rs index 9fded70fd..679f8beed 100644 --- a/brilift/src/lib.rs +++ b/brilift/src/lib.rs @@ -71,3 +71,8 @@ pub fn jit_run(program: &Program, args: Vec, dump_ir: bool) { // Invoke the main function. unsafe { trans.run(entry_id, &main_args) }; } + +/// The C runtime library for Rust library users. +pub fn c_runtime() -> &'static str { + include_str!("../rt.c") +} From b82ce25708d122030e26036d49563aa0c266632b Mon Sep 17 00:00:00 2001 From: Alex Fischman Date: Tue, 26 Mar 2024 11:02:26 -0700 Subject: [PATCH 2/2] Use CARGO_MANIFEST_DIR to make the file path absolute --- brilift/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brilift/src/lib.rs b/brilift/src/lib.rs index 679f8beed..3c8af3751 100644 --- a/brilift/src/lib.rs +++ b/brilift/src/lib.rs @@ -74,5 +74,5 @@ pub fn jit_run(program: &Program, args: Vec, dump_ir: bool) { /// The C runtime library for Rust library users. pub fn c_runtime() -> &'static str { - include_str!("../rt.c") + include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/rt.c")) }