From 3cff0c2a771aa4cb92ee29168a4c579d122bb61e Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Mon, 2 May 2022 22:01:40 -0400 Subject: [PATCH] Make stack bigger by default Add a Cargo feature to allow users to set the stack size if desired, but default to 2MB to handle more use cases. --- ctru-rs/Cargo.toml | 3 ++- ctru-rs/src/lib.rs | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ctru-rs/Cargo.toml b/ctru-rs/Cargo.toml index 148a76a..1016198 100644 --- a/ctru-rs/Cargo.toml +++ b/ctru-rs/Cargo.toml @@ -32,8 +32,9 @@ tokio = { version = "1.16", features = ["rt", "time", "sync", "macros"] } cfg-if = "1.0.0" [features] -default = ["romfs"] +default = ["romfs", "big-stack"] romfs = [] +big-stack = [] [package.metadata.cargo-3ds] romfs_dir = "examples/romfs" diff --git a/ctru-rs/src/lib.rs b/ctru-rs/src/lib.rs index 810c5df..721996b 100644 --- a/ctru-rs/src/lib.rs +++ b/ctru-rs/src/lib.rs @@ -10,6 +10,10 @@ extern "C" fn services_deinit() { } } +#[no_mangle] +#[cfg(feature = "big-stack")] +static __stacksize__: usize = 2 * 1024 * 1024; // 2MB + /// Call this somewhere to force Rust to link some required crates /// This is also a setup for some crate integration only available at runtime ///