Why does static library contain a main function?
问题 I came across a weird static library which contains a main() function (C++). I just wonder what the purpose it is. How does the main() execute? 回答1: From the linker perspective, it doesn't matter where the main function is - it can be in a static library as well as in standalone object file, linker couldn't care less. It produces the executable from object files, no matter where they come from, and in the final executable all the distinction between library/non library symbols is lost. As for