Use two versions of the same native library

40 views
Skip to first unread message

Johan

unread,
Mar 12, 2015, 4:28:01 AM3/12/15
to andro...@googlegroups.com
Hello,

I am currently writing an application that needs to use two versions of the same native library.
From Java, I have not been able to load the two libraries separately because they have the same module name.
Moreover, Java does not support "unloading" a native library, so I decided to use dlopen/dlclose.


What I have is the following:
The two libraries in different folder.
<app-data-folder>/files/version1/liba.so
<app-data-folder>/files/version2/liba.so


My native module that loads and unloads the wanted library version:
v1handle = dlopen("version1/liba.so")
// use version1
dlclose(v1handle)
v2handle = dlopen("version2/liba.so")
// use version2
dlclose(v2handle)



It is currently working well but I would like to know if anybody see any problem doing this?
Moreover, is there any chance that this will not work anymore in future Android releases?

So, is this solution correct and stable (i.e. "long-lasting")?

Thank you in advance for your opinion.

Cheers
Johan

J Decker

unread,
Mar 12, 2015, 6:15:01 AM3/12/15
to andro...@googlegroups.com
Since every library needs explicit loading, I see no issue with this; even if those also had related dependencies.


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-ndk.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages