-
Notifications
You must be signed in to change notification settings - Fork 29
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
Discussion: Adaptable NativeLibraryLoader #32
Comments
Hi @BjoernAkAManf , thanks for your proposal! Leaving the discussion of the API for a PR, I think providing a way to custom behavior around native library loading itself is fine as long as we have some expected use-cases. |
A couple of things actually (at least visionary):
I'll try to prepare a Pull Request once i get the time. |
I see, these requirements are reasonable I think. So basically you want to put a custom (signed) native library to the location (application-local directory) through the build process and let the JVM to load native library from there without extracting an included build out of wasmtime-java jar? If so, would it be doable just by using |
Yes, agreed, that this is somewhat possible right now. However i disagree with the Solution: java.library.path is read-only after JVM start though. Workarounds seem way to hacky (e.g. http://web.archive.org/web/20210614015640/http://fahdshariff.blogspot.com/2011/08/changing-java-library-path-at-runtime.html ). As such i would have either to:
Both of which seem quite counter-intuitive for a Cross Platform Language like java (albeit i agree this is somewhat of a standard). Also i think being able to initialize the application on any supported operating system "as-is" is quite the desireable Dev-Experience and i would therefore prefer being able to write the currently shipped binary to disk. |
So you want wasmtime-java to extract the pre-built jar out of it and use still, but you want control where it's stored temporary? |
I'm sorry, i feel like i'm being quite bad at explaining my use-case. I enjoy being able to just add a maven dependency and "it just works" is great. During development i would want to be able to just download the source code, run maven and "it just works". During deployment in production however, i would prefer the process to be slightly different with a read-only file system. As such in development the binary is copied over and in production the binary is expected to be provisioned by external systems. In both cases the location of the binary needs to be predictable. |
Ok, so in summary: In development phase:
In deployment phase:
And at runtime:
is this understanding correct? In case, I would still encourage to just go with But if that still doesn't satisfy your need, you can submit a PR with concrete code and we can discuss further. At least i'm not strongly against adding interface to let users inject arbitrary native library loading, as I assume it will be doable with a few simple and stable APIs. |
Hi,
as a User of this Library i want to be able to control access of IO. In particular i want to be able to specify the path the native library is beeing written to.
For example i attached the following Class "Native" that emulates the behavior i want to implement.
Unfortunately this requires alot of copy-paste and hackish workarounds.
I would propose extracting the necessary functionality into atleast two parts:
By default i suggest implementing the following Strategies:
Order is provided by each Strategy. As such tryLoadFromLibraryPath would return -1 and loadFromTempfile 1. Other Implementations can then use 0 easily. ServiceLoader would allow to reduce implementation.
The API should provide access to atleast fileName and extension in order to allow writing correctly.
I did not yet start working on a Pull Request, because i feel like this RfC is disruptive to the current implementation and as such I feel @kawamuray you as a Maintainer should first give your Opinion.
Alternatively one could use an Environment Variable, but i feel that is too restrictive for other use cases. Especially when one wants to validate DLL using an out of band signing process.
The text was updated successfully, but these errors were encountered: