Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.