MSVC uses underscores at the beginning of symbol names, and apparently uses PUBLIC
to export a symbol (otherwise labels are internal, like static
variables in C). Try
.data
PUBLIC _foo
_foo DWORD 0
This is essentially what MSVC itself does, see https://godbolt.org/z/Phb4Pv
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…