> 1- __declspec(selectany), which directs the linker to select just one (any > one) of multiple definitions for the symbol and discard the rest. MS > explicitly state this as a quasi-answer for not exposing weak references to > the programmer, but as a commenter notes this is not satisfying – one could > hope to be able to declare a single implementation as _strong_ , thus > enforcing its selection at build time. > > 2- The undocumented #pragma /alternatename, found in CRT sources and > mentioned in this StackOverflow answer. This one helps mimic a different > weak-symbol functionality: initializing the symbol to zero if no definition > is found. This also hardly suffices as a replacement.
* <https://ofekshilon.com/2014/02/10/linker-weak-symbols/> * <https://stackoverflow.com/questions/2290587/gcc-style-weak-linking-in-visual-studio/11529277#11529277> * <https://devblogs.microsoft.com/oldnewthing/20160317-00/?p=93173> * <https://devblogs.microsoft.com/oldnewthing/20200731-00/?p=104024>