Reputation: 1
I am developing an aplication in java to comunicate with a simulator, X-Plane, using the x-plane sdk, it have it in C. I downloaded the SDK and consist in .libm .h and .cpp files.
I have made a search in the internet to see how to load these libraries in my programs and i found the Java Native Interface, so i start to read about that, looking for examples that matches my cases, but i only found the same case, how to create the c library.
My problem is that i already have the header files and the library and is not the .dll.
How can i make the load without crating myself the library
I know that problably is a very easy way, but i do not know, and i appreciate very much the effort to answer me.
Upvotes: 0
Views: 537
Reputation: 4490
If you can't recompile the source code into a dynamic library (e.g., a .so
file) another hack you can do is to make a simple .c
wrapper that statically links in the static library and compile that into a dynamic library. The wrapper can "forward" the calls you need into the static library in order to ensure that the things you need from the static library are included in the binary.
Here is an example of this (where the .o
files on that answer's command line would be replaced by your wrapper).
Upvotes: 0
Reputation: 1
If it's a strict C interface, look at JNA:
http://en.wikipedia.org/wiki/Java_Native_Access
Upvotes: 1