"xiaxia347work"<xiaxia347work@xxxxxxx> writes: > I got a tricky problem when I link my exe program with 2 shared libraries, > the global variable with same name in the 2 .so file may be linked to the same > address, resulting problem that is hard to find. This is not a gcc issue. You didn't mention which OS you are using. I will assume it is GNU/Linux. On GNU/Linux, or any other ELF based system, there is a single global namespace of global variables and functions. When two shared libraries use the same global variable name, they are referring to the same variable. This is a feature. If you want something different to happen, look into symbol visibility and linker version scripts. Ian