Re: dynamic shared library .

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

 



On Thu, Feb 3, 2011 at 4:59 PM, Michal Nazarewicz <mina86@xxxxxxxxxx> wrote:
> On Thu, 03 Feb 2011 15:50:27 +0100, ratheesh k <ratheesh.ksz@xxxxxxxxx>
> wrote:
>
>> when  dll is loaded  .
>>
>>  at the start of execution of elf ?
>>
>>     OR
>>
>>  when the  reference is made into library function or data ?
>
> Depends what you mean by "loaded".  At start of execution, dynamic loader
> reads shared object's header files, maps the library to memory accordingly
> and probably does some more magic with symbol resolution, etc. (I'm not
> an expert and what dynamic loader does is not that trivial).

That would be "normal" libraries that at compile time have been
referenced as needed to be dynamically linked. Ie. those libraries
that you have called/referenced in the compiled code and that the
linker have resolved to be in that dynamoc library. You can find that
list by using "ldd /path/to/<executable>" which would also show you
where the run time linker found those libraries (based on the ld.so
configured paths and the LD_LIBRARY_PATH setting)

Then the "fun" part are those dynamic executables that is loadedby the
program "on demand". An example systemwide is the name service stuff
refered to by the /etc/nsswitch.conf file. Another example is Apache's
loadable modules like the php, perl modules that is not refered to at
startup time by the ELF run time loader, but rather loaded as the
program executes and reads the config files that requests those
modules to be loaded.

>
> However, the whole file is not read into memory and instead, needed
> portions are read as code references them.

Typically the library/dll/.so is mmap(2)ed into the executable address
space, and only read as that part are referenced.

> --
> Best regards,                                       _     _
> .o. | Liege of Serenly Enlightened Majesty of     o' \,=./ `o
> ..o | Computer Science,  Michal "mina86" Nazarewicz  (o o)
> ooo +-<email/jid: mnazarewicz@xxxxxxxxxx>--------ooO--(_)--Ooo--
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-c-programming" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux