-
Notifications
You must be signed in to change notification settings - Fork 129
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
Configurable native library loading strategy? #148
Comments
I’m not opposed to the idea, but could you elaborate how do you see it working for users? If we start supporting new platforms, isn’t it better to contribute them to upstream? |
It would really be best if support for all platforms could be provided upstream. However, I guess this is not an easy thing to do.
For the above reasons, I think it is reasonable for upstream to only provide support for popular platforms. |
So what are you suggesting? Check java.library.path for dll/so/dylib before extracting in Library.java? |
I noticed that skija was hardcoding the supported platforms and forcing to extract and load native libraries from known platform jars.
This is frustrating to me, and I hope that skija can improve the way that native libraries are loaded, making it more flexible for users to provide native libraries.
This is my idea:
In this way, as a third-party user, I can compile and provide the native library jar by myself to support more platforms, such as
windows-arm64
,linux-loongarch64
, etc.java.library.path
.Extracting the dynamic library every time it runs is easy to use, but it's not the best strategy. I figured we could reduce unnecessary operations and hard disk usage by trying to load native libraries from
java.library.path
. We can use a JVM Property to specify whether it wants to load native libraries from java.library.path.In addition to this, doing so is beneficial to provide jmod distribution (Jigsaw support? provided as jmod & could be used for jlink to build os specific runtime #54). When provided as jmod, the native library is placed in the JRE's lib directory by jlink. We can tell if skija is being used as jmod by checking if the class file is in the jrt filesystem, which loads native libraries from
java.library.path
by default.These are my suggestions, what do you think? I can get the job done if that's acceptable.
The text was updated successfully, but these errors were encountered: