diff --git a/glean-core/glean-sym/src/lib.rs b/glean-core/glean-sym/src/lib.rs index 583403ef6a..0ab8a12986 100644 --- a/glean-core/glean-sym/src/lib.rs +++ b/glean-core/glean-sym/src/lib.rs @@ -55,20 +55,26 @@ macro_rules! library_binding { } impl GleanSym { - #[cfg(unix)] + #[cfg(all(unix, not(target_os = "ios")))] pub fn load() -> std::io::Result { let name = libloading::library_filename("xul"); let library = match unsafe { libloading::Library::new(name) } { Ok(lib) => Some(lib), Err(_e) => None, }; - // Try each of the libraries, debug-logging load failures. let $localname = library.ok_or_else(|| { std::io::Error::new(std::io::ErrorKind::NotFound, "failed to find glean library") })?; Ok(GleanSym { $($load)* _library: $localname }) } + #[cfg(target_os = "ios")] + pub fn load() -> std::io::Result { + // On iOS we compile it all together and can look up symbols without loading a library + let $localname: libloading::Library = libloading::os::unix::Library::this().into(); + Ok(GleanSym { $($load)* _library: $localname }) + } + #[cfg(not(unix))] pub fn load() -> std::io::Result { compile_error!("This crate is not implemented for Windows");