linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hendrik Visage <hvjunk@gmail.com>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: linux-c-programming@vger.kernel.org, ratheesh k <ratheesh.ksz@gmail.com>
Subject: Re: dynamic shared library .
Date: Sat, 19 Mar 2011 23:57:07 +0200	[thread overview]
Message-ID: <AANLkTinzu7bW_pBNWWHvQHHDP-Z8qhP=4kQbRCn7p8tY@mail.gmail.com> (raw)
In-Reply-To: <op.vqb09uit3l0zgt@mnazarewicz.zrh.corp.google.com>

On Thu, Feb 3, 2011 at 4:59 PM, Michal Nazarewicz <mina86@mina86.com> wrote:
> On Thu, 03 Feb 2011 15:50:27 +0100, ratheesh k <ratheesh.ksz@gmail.com>
> 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@google.com>--------ooO--(_)--Ooo--
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2011-03-19 21:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTimck7ar6JPzSnNZo_baTz1usHLeUFxkL8GaqriV@mail.gmail.com>
2011-02-03 14:50 ` dynamic shared library ratheesh k
2011-02-03 14:59   ` Michal Nazarewicz
2011-02-10  3:41     ` UDP data Randi
2011-02-10  4:14       ` Chris Donovan
2011-02-10  5:14         ` Randi
2011-02-10 15:41           ` Glynn Clements
2011-02-10 18:43             ` David Astua
2011-02-10 20:49           ` Chris Donovan
2011-03-19 21:57     ` Hendrik Visage [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTinzu7bW_pBNWWHvQHHDP-Z8qhP=4kQbRCn7p8tY@mail.gmail.com' \
    --to=hvjunk@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=mina86@mina86.com \
    --cc=ratheesh.ksz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).