shared libraries

shared libraries

Post by non » Mon, 19 May 2003 16:39:04



i have an application and two or more shared libraries (libA and libB).
libA has some static variables used by functions in libA.
the application is linked dynamically to libA.
now the application loads libB (with dlopen).
but libB uses functions from libA.
does libB have the same variables in libA as the application?
or does libB and the application have their own set of variables in the
memory?

thanks
tom

 
 
 

shared libraries

Post by Michael Kerris » Tue, 20 May 2003 14:22:24



>i have an application and two or more shared libraries (libA and libB).
>libA has some static variables used by functions in libA.
>the application is linked dynamically to libA.
>now the application loads libB (with dlopen).
>but libB uses functions from libA.
>does libB have the same variables in libA as the application?
>or does libB and the application have their own set of variables in the
>memory?

Your description isn't completely clear, but assuming I've understood
correctly: there is one set of variables in libA and accesses from
main(), libA, and libB would all refer to the same variables in libA.
(One possible exception: if there are variables of the same names
declard in libB, then complications could ensue, but I assume that's
not what you are talking about.)

Cheers

Michael

 
 
 

shared libraries

Post by chin » Wed, 21 May 2003 01:26:25



> i have an application and two or more shared libraries (libA and libB).
> libA has some static variables used by functions in libA. the
> application is linked dynamically to libA. now the application loads
> libB (with dlopen). but libB uses functions from libA. does libB have
> the same variables in libA as the application? or does libB and the
> application have their own set of variables in the memory?

Don't know about the rest of you guys, but this reeks of homework to me.
 
 
 

1. Will strip(debug shared library) == nodebug shared library ?

compiling the C++ code without debug option to produce object
files(.o) and then producing the shared library with them. Say, the
size of this library is SIZE_SO_NoD.

compiling the C++ code with debug option to produce object files(.o)
and then producing the shared library with them. Then, do 'strip
library_name'. Say, the size of this library is SIZE_SO_D.

Will SIZE_SO_NoD & SIZE_SO_D be exactly/almost equal ? If yes/no, why?
Also, what exactly 'mcs -d library_name' do? Does it reduce symbols
from the shared library which was produced without debug option also?

2. Linux hardware support is better

3. Help with building shared libraries with dependencies on other shared libraries

4. Old html not working on new server

5. Question: Inclusion of shared libraries during linking of shared libraries

6. tcsh problem

7. Shared library loading shared library.

8. IP Aliasing on a Debian machine

9. Need a Shared Library Guru: beyond simple shared library question

10. When is a shared library not a shared library?

11. Compiling static libraries as shared libraries

12. Building shared library which includes static libraries

13. Can a static library be compiled into a shared library?