Reputation: 1733
I am new to JNI.
I want to link a static library (say libFoo.a) into the dynamic library which I am creating. This dynamic library is being called from my Java class.
Is this possible? If so how?
gcc -I$JAVA_DIR/include -I$JAVA_DIR/include/linux -o libXY.so -shared jni/xy.c libFoo.a
Upvotes: 1
Views: 2703
Reputation: 121599
Q: I want to link a static library (say libFoo.a) into the dynamic library which I am creating. Is this possible?
A: Sure. Just include your .a static library in the link command where you build your shared .so.
This has nothing to do with JNI per se - any shared binary (*nix .so or Windows .dll) can be linked into a shared library in this fashion.
These links should help:
Possible to build a shared library with static link used library?
http://www.tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
Upvotes: 1