Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding Android library loading logic #78

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fourlastor
Copy link
Contributor

@fourlastor fourlastor commented Nov 12, 2024

This PR adds the ability to configure how SharedLibraryLoader loads libraries in Android. This is to allow libraries to be loaded in different ways, for example by using ReLinker.

Initial discussion in libgdx/gdx-liftoff#158, where I was suggested this is a better place for the configuration to exist, as it's also used in other projects (for example box2d bindings).

@tommyettinger
Copy link
Member

This is an interesting one, and doesn't look like much as-is, but being able to painlessly use ReLinker for any native libraries that use gdx-jnigen would be great. It seems like Android has had a need for ReLinker to avoid some nasty library loading bugs for a long time.

@@ -44,6 +44,18 @@ public class SharedLibraryLoader {
static private final HashSet<String> loadedLibraries = new HashSet<>();
static private final Random random = new Random();

static private AndroidLibraryLoader androidLibraryLoader = new AndroidLibraryLoader() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pointing out that this could use a method reference if we can use language level 8.

Copy link
Member

@tommyettinger tommyettinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any possible breakage here; this is only an extension point for other code to use. And I think that other code could really benefit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants