Can gcc and Linux create a dynamic library?

ali hagigat hagigatali@gmail.com
Sat Dec 25 07:32:00 GMT 2010


Thank you Ian.

How can i request gcc to create a dynamic library(not a shared
library)? 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?

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?

Regards

> from	Ian Lance Taylor
> Your understanding is misleading because when you link the program it
> gets a list of the dynamic libraries that it requires.  When the program
> starts up, the dynamic linker finds those dynamic libraries and adds
> them to the address space.  That is, the dynamic library is not added
> when the variable is referenced.  It is added when the program starts
> running.



More information about the Gcc-help mailing list