I am working on C ++ app on Linux using G ++. My app link in a shared library which reveals me a simple API that I need. This library references internally a large number of additional shared lbs. I have to find every one and add them to my makefile to add them.
I think linking my app with any script, depending on primary lib. Is this the only way around the linking requirement, in the stable liberation of all your dependence on the primary lib collection? Is this plug-in model used to do through DLOPAN / DSLSM?
ty
This is the only way around the linking requirement, Did the primary Lib collection be found in the stable Libs of all its dependencies?
No shared library can only link to a shared library which depends on it. Most linker will also pick up those libraries, and link those libraries without mentioning them in your executable linker phase.
In your case, it seems that the shared library is not linked to libraries that need to be linked. The tool can be useful in this regard.
For example, you create this shared library:
gcc -shared foo.o -o libfoo.so -lm
Now
libfoo.so has been linked to the math library (libm). Any application is linked to libfoo. In addition to libm it will be linked, i.e. you must do
gcc -o prog main.o -lfoo
If the library is shared on the other side But it was only
shared by GCC foo.o -o libfoo.so
while linking your application Clearly link to libm:
gcc -o prog main.o -lfoo -lm
When you duplicate a shared library () If you do, runtime linkers take all the libraries Which was also connected to the shared library - unless they are already loaded. So - if a library that you do not connect to Dupl () is not linked to the libraries, and is not associated with your executable libraries, Dlpen will fail (unless you specify RTLD_LAZY , In which case fails later)
Comments
Post a Comment