Can the host application enumerate the imports a .so makes?
If all imports are deemed safe per white list, is it safe to load it into a android process?
The idea is to allow .so plugins to be loaded to render VR content.
How can NDK get the imports list on runtime?
Related
I have read that .so is a dynamic library file and .a is a static library file.
While building openssl i gave the option ./Configure no-shared and it created a lot of .a files.
So, my question is will the other packages like apache will be able to use .a files from openssl?
for example libcrypto.a,
someone please advice me if im going enirely through wrong path.
Basically the static library can be compiled into another application at link time. In your example Apache could use libcrypto.a during build time and include it in the Apache httpd application.
A dynamic .so library can be loaded and unloaded at runtime and you have a better flexibility to change what Apache should support without recompiling the Apache binaries.
Using Apache as example the dynamic loading of .so files are described in the Dynamic Shared Object (DSO) section in the documentation. You can also find links to the installation section which describe how to include static libraries at build time.
There is a good question about this that could be good to read, and that provide mote details in the subject.
Difference between shared objects (.so), static libraries (.a), and DLL's (.so)?
If A.a is static library and two different programs want to use it. A.a is created two times for each program. while If A.so is dynamic library than two programs access same file.
Its mean that you are using reference in library.
If your library is going to be shared among several executables(like apache and openssl), it often makes sense to make it dynamic to reduce the size of the executables. Otherwise, definitely make it static.
In your case you must create dynamic library
Please read -
http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html.
It is a very good tutorial with example.
you will learn -
what is static library (.a) and how to make it.
what is shared library (.so) and how to make it.
difference with .ddl (windows os)
I know how to link with a shared library, and I know if launched by java code, we can System.loadLibrary every .so. So, my question is: how to load multiple .so files with pure ndk. The value of "meta-data android:name='android.app.lib_name'" in AndroidManifest.xml only can specials one library name, how to add the other shared librarys name?
It seems Im not understanding, because if load shared library from java, we need load each shared librarys by System.loadLibrary. but from pure ndk, you can only have one entry, other shared librarys must explicit linked the entry library. so, the android system will load them automaticly.
I'm working on a simple plugin architecture for my app. A plugin is a shared object with a known "get interface" function. I access the .so via dlopen/dlsym etc. Fairly standard.
Some of my plugins have extra .so files that need to be loaded too. These files can be shipped with a plugin fine, but I need the app to know where/how to load them.
So my question is: how to I add a particular plugin's directory to the list of places to look for libraries? I can't set LD_LIBRARY_PATH before starting the app, as the plugin will be loaded some time later. Alternatively, do I need each plugin to explicitly provide the list of dependencies in some kind of manifest file, so that I may load them with dlopen() first? Thanks.
Edit: to clarify, the plugins' directories are not known prior to starting the app, so I cannot set the LD_LIBRARY_PATH at that time.
According to this linux evaluates LD_LIBRARY_PATH before starting the app, so it is unaware of any changes you make at runtime.
I built an android application which uses the libcurlstatic.a, libssl.so,and libcrypto.so in native code and generates one more shared lib called libcurlapp.so ,, Here I would like to know that when ever I want to load this lib in my application is it necessary to load all the libraries or only libcurlapp.so will be enough ..?
Yes your Java code is responsible for loading all necessary shared libraries in the proper order.
This only involves the libs you install with your APK. The system libraries that come with the device in /system/lib will be loaded as needed by the system.
The order you load the libs is important: if libcurlapp.so makes calls to libssl.so and libcrypto.so, you should first load libssl.so and libcrypto.so.
I've spend the morning figuring out how in a makefile to do a shared library install under Linux.
So that's fine; I now have my shared object and a pair of soft links to it, one of which was created by ldconfig and one by me.
Now, I can also build my library as a static library.
When I check /usr/lib, I see the .a files there just being...there. No symbolic links, no arrangement of version and release numbering in filenames.
Should I be arranging my static libraries with symbolic links the same way I arrange my shared objects, or is it in fact customary just to place a static library, unadorned, into /usr/local/lib?
Unlike shared libraries, the static libraries placed into /lib do not participate in dynamic linking dependencies resolution. They're only used when you build your app. Therefore, there's no need to insert symbolic links and precise release numbers into their filenames.
When you link your application with a static library, the linker just embeds the code of the one it found in /lib folder. If, on the other system, the static library with same name will differ, your application even won't know about that. Because it contains the code of the static library it was compiled with and doesn't need to look up it in the system it runs on.
So, the installation of static libraries should differ from that of shared ones: no fine-grained versioning in /lib directory is actually required.