Thread: shared libraries, datasegment and multiple processes

  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,981
    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