summaryrefslogtreecommitdiff
path: root/rust/examples/template/src
diff options
context:
space:
mode:
Diffstat (limited to 'rust/examples/template/src')
-rw-r--r--rust/examples/template/src/main.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/rust/examples/template/src/main.rs b/rust/examples/template/src/main.rs
index 20e082f2..5b21efb3 100644
--- a/rust/examples/template/src/main.rs
+++ b/rust/examples/template/src/main.rs
@@ -7,11 +7,13 @@ fn main() {
// This loads all the core architecture, platform, etc plugins
// Standalone executables probably need to call this, but plugins do not
println!("Loading plugins...");
- binaryninja::headless::init();
+ let headless_session = binaryninja::headless::Session::new();
// Your code here...
println!("Loading binary...");
- let bv = binaryninja::load("/bin/cat").expect("Couldn't open `/bin/cat`");
+ let bv = headless_session
+ .load("/bin/cat")
+ .expect("Couldn't open `/bin/cat`");
println!("Filename: `{}`", bv.file().filename());
println!("File size: `{:#x}`", bv.len());
@@ -37,7 +39,4 @@ fn main() {
}
}
}
-
- // Important! Standalone executables need to call shutdown or they will hang forever
- binaryninja::headless::shutdown();
}