31 lines
798 B
Rust
31 lines
798 B
Rust
use std::{ env, path::PathBuf, process };
|
|
|
|
use open_wrapper::OpenApi;
|
|
|
|
fn main() {
|
|
let dll_path = env
|
|
::args_os()
|
|
.nth(1)
|
|
.map(PathBuf::from)
|
|
.unwrap_or_else(|| PathBuf::from("open_wrapper/lib/open.dll"));
|
|
|
|
println!("Loading Open API from '{}'", dll_path.display());
|
|
let api = match (unsafe { OpenApi::load(&dll_path) }) {
|
|
Ok(api) => api,
|
|
Err(err) => {
|
|
eprintln!("Failed to load '{}': {err}", dll_path.display());
|
|
process::exit(1);
|
|
}
|
|
};
|
|
|
|
println!("Calling connect() ...");
|
|
let rc = unsafe { api.connect() };
|
|
|
|
if rc.is_ok() {
|
|
println!("connect() succeeded with status {rc:?}");
|
|
} else {
|
|
eprintln!("connect() failed with status {rc:?}");
|
|
process::exit(2);
|
|
}
|
|
}
|