geokernel-sys 1.5.31

Dynamically loaded C ABI bindings for the GeoKernel SDK
Documentation
//! Raw GeoKernel C ABI. Every call requires the native SDK's pointer, thread,
//! ownership, callback, and argument preconditions. No native SDK is bundled.
#![allow(non_snake_case, non_camel_case_types, clippy::too_many_arguments)]

pub use libloading::Error as LoadError;
use std::{mem::ManuallyDrop, path::Path};
pub mod types;
pub use types::*;
mod generated;
pub use generated::*;

// Qt owns process-global state that may outlive every wrapper object. Keep
// loaded modules resident; objects are freed normally, modules at process exit.
pub(crate) unsafe fn open(path: &Path) -> Result<ManuallyDrop<libloading::Library>, LoadError> {
    #[cfg(windows)]
    let library = libloading::os::windows::Library::load_with_flags(
        path,
        libloading::os::windows::LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
            | libloading::os::windows::LOAD_LIBRARY_SEARCH_DEFAULT_DIRS,
    )?
    .into();
    #[cfg(not(windows))]
    let library = libloading::Library::new(path)?;
    Ok(ManuallyDrop::new(library))
}