Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If a dynamic library exports the address to a global variable defined within the library, how are accesses to that variable translated during dynamic linking so that a running application can interact with it?

share|improve this question
Compiling does the same thing as always - it dumps its symbol table into the object code, translating variable names into offsets. Fixing up the address so that an already running process can read/write it is the job of the dynamic linker or loader. – Kilian Foth Jun 5 '13 at 12:10
Do you mean a global variable? In C, which you tagged your question with, static variables have internal linkage - they're not visible outside the translation unit, much less outside a dynamic library. – Sebastian Redl Jun 5 '13 at 12:40
@KilianFoth true. I will edit my question. – Victor Jun 5 '13 at 13:25
@SebastianRedl yes, I did mean to say global, thank you. – Victor Jun 5 '13 at 13:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.