user2843569
user2843569

Reputation: 11

calling jni method from other jni library

Is it possible to call jni method of 1 library from another method of different jni library ? for eg: I have 2 libraries lib_1.so and lib_2.so.

I want to call a method get_interface() of lib_1.so from lib_2.so.

Is this possible? If yes, please share the example of how this can be done.

Upvotes: 1

Views: 768

Answers (2)

Samhain
Samhain

Reputation: 1765

When calling from one shared library to another, its really no longer jni, its just native code(c->c or c++ -> c++). Include the .h and invoke the function as you would normally, passing whatever parameters the function requires.

Upvotes: 2

Alexander
Alexander

Reputation: 48272

I think you can do dlopen("lib2.so") from lib1.so so you have a handle to your lib2.so library and then using that handle you can call the methods.

Upvotes: 0

Related Questions