File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1
1
//! Program startup and shutdown.
2
+ //!
3
+ //! To use origin's program startup, define a function named `origin_main` like
4
+ //! this:
5
+ //!
6
+ //! ```no_run
7
+ //! #[no_mangle]
8
+ //! fn origin_main(argc: usize, argv: *mut *mut u8, envp: *mut *mut u8) -> i32 {
9
+ //! todo!("Run the program and return the program exit status.")
10
+ //! }
11
+ //! ```
12
+ //!
13
+ //! Origin will call this function after starting up the program and running
14
+ //! the constructors. `argc` is the number of command-line arguments with a
15
+ //! value of at most `c_int::MAX`, and `argv` is a pointer to a NULL-terminated
16
+ //! array of pointers to NUL-terminated C strings. `argc` and `argv` describe
17
+ //! the command-line arguments. `envp` is a pointer to a NULL-terminated array
18
+ //! of pointers to NUL-terminated C strings containing a key followed by `b'='`
19
+ //! followed by a value. It describes the environment variables. The function
20
+ //! should return a value for the program exit status.
21
+ //!
22
+ //! This is a low-level and somewhat C-flavored interface, which is in tension
23
+ //! with origin's goal of providing Rust-idiomatic interfaces, however it does
24
+ //! mean that origin can avoid doing any work that users might not need.
2
25
3
26
#[ cfg( feature = "origin-thread" ) ]
4
27
use crate :: thread:: initialize_main_thread;
You can’t perform that action at this time.
0 commit comments