From f77baccb015c00dab5dd42d69ea50b409e2a5c78 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Sun, 14 Jul 2024 17:27:53 +0900 Subject: [PATCH] Fix --- Cargo.lock | 1 + sac/Cargo.toml | 3 ++- sac/src/lib.rs | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 788f238d7..d08028325 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -620,6 +620,7 @@ name = "stak-sac" version = "0.1.44" dependencies = [ "clap", + "libc", "main_error", "stak-configuration", "stak-device", diff --git a/sac/Cargo.toml b/sac/Cargo.toml index d7bd1cc50..b5b62cd3e 100644 --- a/sac/Cargo.toml +++ b/sac/Cargo.toml @@ -9,7 +9,7 @@ readme.workspace = true repository.workspace = true [features] -libc = ["stak-device/libc", "stak-file/libc"] +libc = ["dep:libc", "stak-device/libc", "stak-file/libc"] std = [ "dep:clap", "stak-device/std", @@ -21,6 +21,7 @@ std = [ [dependencies] clap = { version = "4.5.9", features = ["derive"], optional = true } +libc = { version = "0.2.155", optional = true } main_error = "0.1.2" stak-configuration = { version = "0.1.38", path = "../configuration" } stak-device = { version = "0.2.42", path = "../device" } diff --git a/sac/src/lib.rs b/sac/src/lib.rs index 70de658ee..f2c309231 100644 --- a/sac/src/lib.rs +++ b/sac/src/lib.rs @@ -4,6 +4,8 @@ pub mod __private { #[cfg(feature = "std")] pub use clap; + #[cfg(feature = "libc")] + pub use libc; #[cfg(feature = "std")] pub use main_error; pub use stak_configuration; @@ -86,6 +88,7 @@ macro_rules! libc_main { }; ($path:expr, $heap_size:expr) => { use $crate::__private::{ + libc::exit, stak_device::libc::{ReadWriteDevice, Stderr, Stdin, Stdout}, stak_file::LibcFileSystem, stak_macro::include_r7rs, @@ -97,7 +100,7 @@ macro_rules! libc_main { #[cfg(not(test))] #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { - unsafe { libc::exit(1) } + unsafe { exit(1) } } #[cfg_attr(not(test), no_mangle)]