What do #![no_start]
, #![no_main]
, #[lang = "start"]
, #[start]
and #[main]
do?
Disable automatically linking in the libnative
crate and thus the default start language item.
This means you'll probably need #![no_main]
, #![lang = "start"]
or #[start]
instead.
Note: #![no_std]
implies #![no_start]
.
No main (entrypoint) function. You will want this if you’re linking with something that insists on providing main
(such as SDL).
The function called from the actual entry point (real main). It is passed argc
, argv
and a pointer to the user’s main function (i.e fn main
or whatever is marked with #[main]
).
The default one in libnative
sets up the runtime then calls your main.
fn (rust_main: *u8, argc: int, argv: **u8) -> int;
Overrides the start lang item. It too is called from the actual entry point (real main). It is only passed argc and argv.
Signature:
fn (argc: int, argv: **u8) -> int;
Equivalent to:
#![no_main]
fn my_start(argc: int, argv: **u8) -> int { … }
#[no_mangle]
extern "C" fn main(argc: int, argv: **u8) -> int {
my_start(argc, argv)
}
Let’s you mark a function as the main function (called by the start lang item).
#[main]
fn whatever_I_want_to_call_this() { … }