fusesource / hawtjni

A JNI code generator based on the JNI generator used by the eclipse SWT project
http://fusesource.github.io/hawtjni/
Apache License 2.0
165 stars 61 forks source link

Load dylib dependency from the jar archive #62

Open Tolsi opened 4 years ago

Tolsi commented 4 years ago

Hi, I can't load the dylib native dependency packed in jar package because of this line https://github.com/fusesource/hawtjni/blob/c14fec00b9976ff6b84e62e483d678594a7d3832/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java#L360

If System.mapLibraryName(libName) returns a .dylib filename then we replace it to .jnilib and returns. It looks like a bug, why we change the native lib extension to different if it supported by the runtime system and was returned by it. It works when I specify java.library.path with the .dylib lib.

gnodet commented 4 years ago

I suppose we could change the Library.map method so that it returns a String[] and iterate on this array in the Library.doLoad method. @Tolsi Would you mind creating a PR for that ?