Expand description
Prevents emitting the main entrypoint symbol.
Written as an inner attribute at the top of the crate root, the no_main attribute prevents
the compiler from generating the program’s standard Rust entrypoint, leaving that up to you.
This is useful when some other object being linked into the program defines the entrypoint,
or when you want to define the platform’s main symbol yourself.
If you define an entry point symbol that is suitable for your target, it must also be exported
under an unmangled name using the no_mangle attribute:
#![no_main]
use std::ffi::{c_char, c_int};
#[unsafe(no_mangle)]
pub extern "C" fn main(_argc: c_int, _argv: *const *const c_char) -> c_int {
println!("Hello world!");
0
}Unlike no_std, the no_main attribute does not prevent the compiler from generating
the startup routine or linking the standard library provided by the operating system’s executable ABI.