-
Notifications
You must be signed in to change notification settings - Fork 314
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
Java loader loaded #559
Java loader loaded #559
Conversation
This can replace #557. |
@atoulme is this working now properly? |
It does. I will change the variable name in a separate commit. If you approve I’ll merge. |
* | ||
* @return true if the library is available | ||
*/ | ||
public static boolean isAvailable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must this be public? Seems to be only used inside create()
. Drop it if not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, otherwise another program located in a different java package cannot check if EVMC is available.
try { | ||
Path evmcLib = Files.createTempFile("libevmc-java", extension); | ||
Files.copy( | ||
EvmcVm.class.getResourceAsStream("/libevmc-java." + extension), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what is the best practice for this, but can you use fixed extension for all OSes? E.g. put it in the JAR as java/src/main/resources/libevmc-java.jni
and the load as System.load("/tmp/libevmc-java.jni")
. You will not have to figure out the OS-specific DLL extension.
Did you test it on Windows? On Windows the DLLs don't have the "lib" prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would want to package all native libraries in the Java jar. This means the jar contains a .so, a .dylib, and a .dll, at a minimum. You can always let folks place the native lib in the path if they want to load their custom library or use a 32 bit system.
I guess the best way to test on Windows would be to have a CircleCI Windows build, I don't have a Windows machine.
Co-authored-by: Paweł Bylica <[email protected]>
Co-authored-by: Paweł Bylica <[email protected]>
f490b0c
to
4be112c
Compare
5b88bd9
to
af53ab9
Compare
af53ab9
to
99abe16
Compare
Can you look at the cmake build failure in Windows? I probably miss something basic. |
Rebased and pushed this entire branch over #557. However dropped Windows support as that can be dealt with later. |
Trying out lazy loader with temp file