1#![allow(non_snake_case, non_camel_case_types, clippy::too_many_arguments)]
4
5pub use libloading::Error as LoadError;
6use std::{mem::ManuallyDrop, path::Path};
7pub mod types;
8pub use types::*;
9mod generated;
10pub use generated::*;
11
12pub(crate) unsafe fn open(path: &Path) -> Result<ManuallyDrop<libloading::Library>, LoadError> {
15 #[cfg(windows)]
16 let library = libloading::os::windows::Library::load_with_flags(
17 path,
18 libloading::os::windows::LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
19 | libloading::os::windows::LOAD_LIBRARY_SEARCH_DEFAULT_DIRS,
20 )?
21 .into();
22 #[cfg(not(windows))]
23 let library = libloading::Library::new(path)?;
24 Ok(ManuallyDrop::new(library))
25}