uniffi-rs icon indicating copy to clipboard operation
uniffi-rs copied to clipboard

Improve integration with megazord library loading

Open rfk opened this issue 4 years ago • 1 comments

Currently, Kotlin consumers can customize the name of the .so file from which to load a component, by specifying the uniffi.component.${componentName}.libraryOverride system property.

This works for simple cases, but it doesn't fully support the appservices megazord-loading procedure, which involves checking various system properties to see whether the application is using a custom megazord. See for example the logic being added to Glean to support the appservices megazord in https://github.com/mozilla/glean/pull/1290.

I think a better solution here would be a build-time config (perhaps via our new uniffi.toml file) to specify the name of the findLibrary function that should be called when loading the bindings. It can default to the one currently provided by uniffi, but components could redirect to a different function that applies whatever run-time lookup logic is needed.

┆Issue is synchronized with this Jira Task ┆Issue Number: UNIFFI-35

rfk avatar Nov 06 '20 03:11 rfk

Ref https://github.com/mozilla/uniffi-rs/pull/389 which added a cdylib_name option to specify the name of the library to load. This doesn't help with using a dynamically-loaded library name, but it's a start in that direction.

rfk avatar Jun 01 '21 05:06 rfk