How does compiler(gcc) know whether a function is to be dynamically linked or not?
For example,printf is dynamically linked.
But how does the compiler(g开发者_如何学编程cc) know that?
gcc doesn't know that. It knows there is a function printf and it knows how to call it, but the object file it generates contains a call to an unresolved symbol.
The symbol is then resolved by the linker, which is given all your object files and libraries. The linker finds the symbol printf in a library, and after its combined all the relevant modules, it updates the unresolved calls.
加载中,请稍侯......
精彩评论