Re: Can gcc and Linux create a dynamic library?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ali hagigat <hagigatali@xxxxxxxxx> writes:

> How can i request gcc to create a dynamic library(not a shared
> library)?

I'm sorry, I don't understand the question, because as I use the words
there is no difference between a "dynamic library" and a "shared
library."  They are the same thing, and you get them by using the option
-shared.

> When we create a dynamic library, there will be multiple
> copies of the code of that library in the main physical memory for
> each program which uses that library?

In the normal case, the code for the dynamic library will be shared
between all executables which use the dynamic library, so there will
only be a single copy of pages of the dynamic library in physical
memory.

> If there is always one copy for the library: Considering that library
> has some global variables and functions and program A changes those
> variables, then program B starts up and uses the same library. Then B
> can not use the same initial state as A. Is that right?

Variables are not shared, only code and read-only data.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux