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?
How does a dynamic library's references to a global variable get translated once in the running app?
Asked
Active
Viewed 3,408 times
1 Answers
1
Dynamic linking is operating system specific (and very different on Linux and on Windows; read Levine's Linkers and Loaders book).
For Linux, a good explanation happens in Drepper's How to write shared libraries paper.
In general, the access to such a global variable may involve some indirection. Read about the Global Offset Table.
Basile Starynkevitch
- 32,862