Find the answer to your Linux question:
Results 1 to 3 of 3
Hi All, I have a doubt related to shared libraries(.so), please clarify. 1. How shared library will link to executable? It is like shared library will load at different memory ...
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    3

    shared libraries

    Hi All,

    I have a doubt related to shared libraries(.so), please clarify.

    1. How shared library will link to executable? It is like shared library will load at different memory location along with the executable file.

    2. If two different C programs are using the same shared library and both the programs start at the same time then how many times the shared library will be loaded in to the memory?


    Thanks,
    Kumar

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    1. Shared libraries are compiled as position independent code (PIC), which means that the dynamic linker/loader will set up the actual function and variable addresses when the library is loaded. Because of how virtual memory works, the executable and shared libraries will share text (code), stack, and heap memory segments.

    2. There will only be one copy in memory, even though each invocation will reside possibly at different virtual address spaces. This is complex stuff and we certainly don't have to room here to get into all the gory details. That is what an advanced academic class of a semester or two might cover.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Dec 2010
    Posts
    3
    Thanks very much for the clarification.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...