shared libraries, datasegment and multiple processes

This is a discussion on shared libraries, datasegment and multiple processes within the Linux Programming forums, part of the Platform Specific Boards category; Hi All, I have a shared library that defines and uses a global variable and a atatic variable. My question ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    1

    Thumbs up shared libraries, datasegment and multiple processes

    Hi All,

    I have a shared library that defines and uses a global variable and a atatic variable. My question is that whether shared libraries have a datasegment.

    If yes does that mean that this datasegment will be accessed accross multiple processes, thereby works like a shared memory and some short of synchronisation logic is needed within the library to serialize the access?

    If no then how these global varibles will be placed into the caller datasegment. I mean how the linker will solve the symbols? Will these symbols be exported to the caller through the stub?

    Does all this depend upon the operating system used?
    Any help will be most appreciated.

    Thnks,
    Ashim

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,701
    Each process gets its own copy of library data - only the code is shared.

    http://tldp.org/HOWTO/Program-Librar...ies.html#AEN70

    gg

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21