nativelibs4java / JNAerator

JNAerator: native bindings generator for JNA / BridJ / Node.js
http://jnaerator.googlecode.com
504 stars 108 forks source link

Bundled library not found #115

Open MFAshby opened 6 years ago

MFAshby commented 6 years ago

I have used JNAerator to produce java bindings for a shared library using the corresponding headers. The generated code can't find the native library at runtime. (I get UnsatisfiedLinkError)

I used the following options to generate the bindings: $JNAERATOR -mode StandaloneJar -runtime JNA -forceStringSignatures -beanStructs -beautifyNames deezer.h Linux/x86_64/libdeezer.so -jar ../lib/deezer.jar

In the jar that was produced, the library file was put in the following location: lib/linux_x64/libdeezer.so

However, debugging the problem I can see that when the code searches for the library in resources, it looks in the following location: x86_64-linux-gnu/libdeezer.so

See com.sun.jna.Native#extractFromResourcePath(...)

This makes the generated standalone jar useless!

MFAshby commented 6 years ago

Offending code that packages it in the wrong place: com.ochafik.lang.jnaerator.JNAerator#getResourceFiles