(runtime_dir: &Path)
| 95 | static LIBKRUN: OnceLock<LibKrun> = OnceLock::new(); |
| 96 | |
| 97 | pub fn libkrun(runtime_dir: &Path) -> Result<&'static LibKrun, String> { |
| 98 | if let Some(lib) = LIBKRUN.get() { |
| 99 | return Ok(lib); |
| 100 | } |
| 101 | |
| 102 | validate_runtime_dir(runtime_dir)?; |
| 103 | let loaded = LibKrun::load(runtime_dir)?; |
| 104 | let _ = LIBKRUN.set(loaded); |
| 105 | Ok(LIBKRUN.get().expect("libkrun should be initialized")) |
| 106 | } |
| 107 | |
| 108 | pub fn required_runtime_lib_name() -> &'static str { |
| 109 | #[cfg(target_os = "macos")] |
no test coverage detected