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.
Are you looking for integration of native libraries?
I just created a PR for AllPlay, which is using native libraries for linux and windows. Especially the MANIFEST.MF should in interesting for you.
Thanks for the hint.
For the moment though I’m still learning (a lot ) and to be honest: I don’t get the point (yet) how this can be important for this project.
did you get something running? I’m new to openhab, but I’d really like to get it working with my Beckhoff system. If you need help, I’d like to join you.
I read that you were trying to set up a home automation system with openHAB and Beckhoff CX9020. Did you succeed? I have the same hardware, and interests.
Hello!
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).