Use static Windows libraries from java code with minimal effort (preferably using JNA)

I need to use some static Windows library ( *.lib) from java code, I can write C ++ JNI shells, but I would prefer not to do this (not what it was in C ++).

What will be the easiest (least developing) way to use it, performance is not important, since this code will simply extract some data, which will most likely work on the JAVA side.

Most likely, I would use JNA , but AFAIK it needs dynamic libraries, and I have static ones.

I also asked questio n about converting static libraries to dynamic ones.

+3
source share
2 answers

For what it was worth, I had a project like this some time ago. It was pretty easy to auto-generate JNI wrappers. I think we had about 350 export functions. It took us about 3 hours to build a script to automatically generate a wrapper (sorry, do not use a convenient script or I would publish it).

We ourselves did not write almost C ++ code, but it required an understanding of how JNI works ... This is a really good opportunity / training project - if you have time, do not be afraid of JNI - you will be amazed how much you learn about how the jvm works ...

, , - . JNI native ( ), .

, , , , 1 Java .

, , .lib .dll JNA: -)

+2

DLL ( ), , JNA DLL.

+3

Source: https://habr.com/ru/post/1708026/


All Articles