title: How Do C++ Compilers Merge Identical String Literals
body: <p>How does compiler (MS Visual C++ 2010) combine identical string literals in different cpp source files?  For example, if I have the string literal "hello world\n" in src1.cpp and src2.cpp respectively.  The compiled exe file will have only 1 "hello world" string literal probably in the constant/readonly section.  Is this task done by the linker?</p>
  
  <p>What I hope to achieve is that I got some modules written in assembly to be used by C++ modules.  And these assembly modules contain many long string literal definitions.  I know the string literals are identical to some other string literals in the C++ source.  If I link my assembly generated obj code with the compiler generated obj code, would these string literals be merged by the linker to remove redundant strings as is the case when all modules are in C++?</p>