I want to develop a binding for Beckhoff Plc devices. I want to use the “TcJavaToAds” lib to communicate via the ads protocol.
If I now call methods from the jar-lib, I always get the error "Library <ADSToJava.dll> not found!"
So the native library is not found. I already tried by adding “Bundle-NativeCode: adstojava.dll; processor=x86” to the manifest.mf. But it didn*t work out.
Does anyone know how to setup the project, that the native lib is found?
This was a lib for 64bit Linux - this worked for me. So in general, I would say that you did it correct. I have never tried native code on Windows though, so I cannot tell you if there is anything specific to be aware of…
Another trick you could try is to use the JVM param -Djava.library.path=<some local directory>. You can then put your dll in there and don’t have to resolve it within your bundle through OSGi.
I’ve stumbled upon this while i also wanted to ask a question about including native code.
Could you explain what this Bundle-NativeCode line in the manifest does ? I know that some JAR vendors include own code in order to extract the library from JAR into some location and load explicitly from that location. Also i know that java.library.path for OpenHAB is already set to /var/openhab2/tmp/lib. Will this line deploy the library for me ?
What should i do if my native library depends on some more 3rd party libraries: libsodium and protobuf-c ? Both of these dependencies are available via apt-get install on e.g. Armbian. But how to track this? Should i just document it in .md file for my binding and openhab-addons package will have appropriate dependencies when my binding is accepted into the distribution ?
Unfortunately it would be very problematic to make a self-contained build of my library because this would require special build for all the dependencies (static .a archive but with -fPIC option).