jnr / jffi

Java Foreign Function Interface
Apache License 2.0
168 stars 78 forks source link

try loading the library with `System.loadLibrary()` #96

Open paulo-raca opened 3 years ago

paulo-raca commented 3 years ago

Some environments have their own way to ship native libraries (e.g., Android).

On those it is preferrable to rely on System.loadLibrary instead of manually extracting/loading the library from resources

headius commented 3 years ago

This seems like a fine thing to add, but if the other forms of loading fail couldn't we put this at the end of the method?

My concern is that by putting this at the front of the list, we defer all searching and loading to the JVM first, which may cause it to load a library from a default location rather than a location configured by a user (which is important on secure systems).

Can you get the same effect moving the loadLibrary call to the end? If so, do that and I will happily merge and release this.

headius commented 3 years ago

No follow-up so I have not merged this. Still willing to consider it!

paulo-raca commented 2 years ago

@headius, my apologies, I lost track of this.

Yes, moving it to the end also works, and the security considerations make sense :+1: