Similar to TLS, I'm looking for some method to have global set of variables that are similar in definition in a few DLLs, but have different addresses.
For example, consider a.dll, b.dll and lib.dll, all loaded into memory.
I need both a.dll and b.dll to have an exported global, say, char fname recognized in lib.dll; in a.dll fname=="a.txt", in b.dll fname=="b.txt".
Both DLLs call at some point a lib.dll function, that uses the global to, say, output some data to the file fname.
Note: not like TLS, this all might be using a mere one thread so TLS is ruled out. That means that I need some mechanism that whenever a process "swithces" DLL, a new set of physical memory pages is mapped to the correct address space.