So my statement of "the running applications are not capable of writing to the memory that the shared library lives" was actually correct? I'm confused now.
No. It may be true on linux, but not on Windows. On Windows, you have to use a special compiler directive to make the memory shared. For instance, on MSVC you would do:
Code:
int varThatIsNotShared = 0;
#pragma data_seg(".SHARDAT")
int someSharedVar = 0;
#pragma data_seg()
#pragma comment(linker, "-section:.SHARDAT,rws")
So if a DLL has the above code, and some exported functions to manipulate the two variables, they will behave differently. Let's say application A links to this DLL and increments both variables. If application B links to the DLL and reads the variable's values, he will see varThatIsNotShared = 0, and someSharedVar = 1.
Note that this shared memory can be written to by every process depending on the parameters passed to -section.