Statically linked libraries and JNI?

I am planning an application that will use an existing 3rd party SDK supplying a collection of statically linked (.lib) C ++ libraries. I would like to write my own application in Java, so played around a bit with loading existing SDK libraries into a VM.

However, as far as I can tell, the JVM seems to only be able to use dynamically linked libraries (.dlls).

It's true? If so, perhaps there is a problem - for example, compiling my DLL that references static libraries? I have quite a lot of experience with Java, but I am new to both JNI and C / C ++, so any answer or nudge in the right direction would be greatly appreciated.

Hooray!

+3


source to share


1 answer


You're right: the JVM can load dll

(usually you have startup code in your Java source containing the functions native

to load them). It cannot load lib

s.

So, you need to create dll

one that statically references lib

s.



The usual way to do this is to run a program javah

that will generate stubs for the functions dll

you need to implement.

+3


source







All Articles