Thursday, 8 August 2013

What is global mutable variable behaviour in dynamically-linked libraries?

What is global mutable variable behaviour in dynamically-linked libraries?

When a dynamically linked library includes a global mutable variable, such
as a container for state initialised when loading the library, how do
references to that variable behave when running an application that links
against it?
Obviously the application cannot alter memory allocated to the
dynamically-linked library by the OS, as that would have implications on
the other applications using it, so one must assume references to the
global mutable variables are rewritten to refer to some R/W memory space
owned by the application. But exactly how do the compiler and linker
collude to accomplish this?

No comments:

Post a Comment