To be clear, #[no_std] only "removes" the runtime by ensuring you don't accidentally use any functions that need the runtime. Something like
#![crate_id="basic_lib"]
#![crate_type="dylib"] // for a .so
/* not there's no `no_std` */
#[no_mangle]
pub extern "C" fn add_in_rust(x: i32, y: i32) -> i32 {
x + y
}
Compiling that will give a `libbasic_lib....so` which can be linked against by any C program, and the `add_in_rust` function called without the Rust code needing to touch a runtime. (I imagine that one may have to add some extra linker flags.)
There are many functions/types in libstd etc. that can be used without a runtime (although its still not as great as it will be in future).
There are many functions/types in libstd etc. that can be used without a runtime (although its still not as great as it will be in future).