Unsafe block and order call function

I have custom lib.

     extern {
        fn from_mylib();

fn main() {
     println!("try call...");

    unsafe {

    println!("\n");   // this must call after unsafe block

compile and run

try call...

hello from My Lib!

Why second println! called ALWAYS before unsafe block

Rust version

$ rustc --version
rustc 1.0.0-beta

Does from_mylib() print with a newline at the end? stdout is line buffered and will only be automatically flushed to screen when a newline is printed. You can also flush it manually.

1 Like