John Qualis
John Qualis

Reputation: 1733

linking a static library in JNI

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

Answers (1)

paulsm4
paulsm4

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:

Upvotes: 1

Related Questions