In C programs, there's always a function named main
that's called to start the application.
Mynewt OS is written in C, so Mynewt uses the same convention... It expects us to provide a C function named main
that is called upon startup.
Our application is in Rust not C. We exposed our Rust function named main
as a C function, like this...
extern "C" fn main()
Our Rust Application is actually compiled into a Rust Library that's linked into Mynewt OS.
By convention, a Rust Library must have a lib.rs
file that defines the Rust functions (and optionally, includes other Rust source files).
That's why our Rust main
function is in lib.rs
.