共享变量的赋值发生在模块被导入内存瞬间吗?
刚才 看了MSDN上的 Warning LNK4092 的解说,其中有:For example, you have a DLL that contains declarations like this in a shared data section:
Copy Code
int var = 1;
int *pvar = &var;
The linker cannot resolve pvar because its value depends on where the DLL is loaded in memory, so it puts a relocation record in the DLL. When the DLL is loaded into memory, the address of var can be resolved and pvar assigned. If another process loads the same DLL but cannot load it at the same address, the relocation for the address of var will be updated for the second process and the first process's address space will point to the wrong address.
按照这个说法,不同模块导入这同一个DLL时,他们的共享变量值是相等的,而且他们的赋值是在导入时刻被重新计算一次,我英语不好,不知道我的理解对不对??
共享