Bug 2018944 - glean-sys - a Rust API built on top of the Glean UniFFI C FFI#3426
Draft
Bug 2018944 - glean-sys - a Rust API built on top of the Glean UniFFI C FFI#3426
Conversation
dab03d7 to
23adcc4
Compare
badboy
commented
Mar 30, 2026
| #[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "windows")))] | ||
| let name = "libxul.so"; | ||
|
|
||
| let library = match unsafe { libloading::Library::new(name) } { |
Member
Author
There was a problem hiding this comment.
fwiw, I tried it with libloading::os::unix::Library::this(), but then it couldn't find the symbols, even though I'm certain libxul was already loaded. This might need some testing to ensure we're not the first ones loading libxul and that loading it again doesn't have any other negative impact.
…ated code over FFI This will be used later by glean-sys to build a Rust API via C FFI.
…C FFI This loads `libxul.so` (currently hard-coded), looks up the required symbols and wraps that in a nice Rust API. Other crates can depend on `glean-sys`, without needing to have Glean in the same library.
23adcc4 to
a6d1ef4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This small patch on a-s makes use of the new glean-sys crate: mozilla/application-services@main...badboy:application-services:glean-dylib
Todo:
glean-sys.glean-sysand we inject alibxul.sointo it at test timeglean-sys/src/metrics.rsis generated. Currently by a test. That has a bit of a problem that you need to compile the code to generate the code, which breaks if the code doesn't compile. Might want to have a non-test way to generate that code.libxul.sois hard-coded. Ok for manual testing in Fenix, not sure we want to ship that as-islibxul.glean-build) to generate the correct code usable withglean-sys