Home > Archive > Unix Programming > December 2004 > Shared libraries
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Bryan Bullard 2004-12-15, 8:57 pm |
| Greetings,
1) If I create "static" or "global" data in my shared object library, where
is it linked to (a section)?
2) Is these section loaded in a way that it is mapped per-process or
globally?
TIA
| |
| Måns Rullgård 2004-12-15, 8:57 pm |
| "Bryan Bullard" <replay@to.group.com> writes:
> Greetings,
>
> 1) If I create "static" or "global" data in my shared object library, where
> is it linked to (a section)?
Most systems place initialized data in the ".data" section.
Uninitialized (and thus all zeros) data is mentioned in the ".bss"
section, but is not actually stored in the object file, since the
runtime loader can easily allocate a block of zeros given only the
size required. Read-only data might go into the ".rodata" section,
and can of course be shared between processes.
> 2) Is these section loaded in a way that it is mapped per-process or
> globally?
The ".data" section is mapped per-process. Most likely, it is
copy-on-write, but that's an implementation detail.
Data is shared between processes only if explicitly requested, for
which there are various ways.
--
Måns Rullgård
mru@inprovide.com
| |
| Roger Leigh 2004-12-15, 8:57 pm |
| -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
"Bryan Bullard" <replay@to.group.com> writes:
> 1) If I create "static" or "global" data in my shared object library, where
> is it linked to (a section)?
Linked /to/? It gets placed in .data or .bss depending upon whether
it's initialised or uninitialised data. It may also have an entry in
..got if it's "exported" (at least on GNU/Linux).
> 2) Is these section loaded in a way that it is mapped per-process or
> globally?
"Globally" in what context? I'm assuming you mean so that it's
visible in all processes that map it, in which case the answer is no,
thank goodness.
Regards,
Roger
- --
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iD8DBQFBwMhsVcFcaSW/ uEgRAvyfAJ48tBLBetfwJkV6PCA6RNyOHk6goQCg
tfM7
x6vXGWaXEQSl6RExuThaLNA=
=a6+S
-----END PGP SIGNATURE-----
| |
| Bryan Bullard 2004-12-16, 4:05 pm |
|
"Roger Leigh" <${roger}@invalid.whinlatter.uklinux.net.invalid> wrote in
message news:878y7zywep.fsf@whinlatter.whinlatter.ukfsn.org...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> "Bryan Bullard" <replay@to.group.com> writes:
>
where[color=darkred]
>
> Linked /to/? It gets placed in .data or .bss depending upon whether
> it's initialised or uninitialised data. It may also have an entry in
> .got if it's "exported" (at least on GNU/Linux).
>
>
> "Globally" in what context? I'm assuming you mean so that it's
> visible in all processes that map it, in which case the answer is no,
> thank goodness.
Thank you.
....
| |
| JeanLucP 2004-12-29, 7:32 am |
| I have question related to shared library. How can i compile picture images into shared library for later usage? |
|
|
|
|